Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++.moderated > #7316

Re: Avoid 'int' and associates.

Message-ID <369e6437-a6e7-4420-91dc-eefe57459462@googlegroups.com> (permalink)
Newsgroups comp.lang.c++.moderated
From pip010 <pip010@googlemail.com>
Subject Re: Avoid 'int' and associates.
Organization unknown
References (4 earlier) <bcKdnd8ZC4KYmOLInZ2dnUU7-VednZ2d@giganews.com> <mlna37$md5$1@dont-email.me> <y6OdnUG8htn2rOLInZ2dnUU7-KOdnZ2d@giganews.com> <mlptdg$kpq$1@speranza.aioe.org> <V-6dnW-qcNlPEB3InZ2dnUU7-LGdnZ2d@giganews.com>
Date 2015-08-03 06:54 -0600

Show all headers | View raw


{ quoted server banner redacted. lines wrapped to fit
 in ~70 characters. -mod }

On Tuesday, June 16, 2015 at 11:50:14 PM UTC+2, Mr Flibble wrote:
> On 16/06/2015 22:03, Chris M. Thomasson wrote:
> >
> >> "Mr Flibble"  wrote in message
> >> news:y6OdnUG8htn2rOLInZ2dnUU7-KOdnZ2d@giganews.com...
> >
> >> [...]
> >> You are speaking for a lot of people there. As far as code reviews are
> >> concerned the MISRA C++ coding standard for safey critical systems
> >> prohibits the use of basic numerical types and mandates the use of the
> >> typedefs from <cstdint> (or an equivalent).
> >
> > Programming a warplane, anyone?:
> >
> > http://www.stroustrup.com/JSF-AV-rules.pdf
> 
>  From that document (relevant to this thread):
> 
> AV Rule 209 (MISRA Rule 13, Revised)
> The basic types of int, short, long, float and double *shall not* be 
> used, but specific-length
> equivalents should be typedef'd accordingly for each compiler, and these 
> type names used in
> the code.
> Rationale: Since the storage length of types can vary from compiler to 
> compiler and
> platform-to-platform, this rule ensures that code can be easily 
> reconfigured for storage size
> differences by simply changing definitions in one file. See AV Rule 209 
> in Appendix A for
> additional details.
> Exception: Basic types are permitted in low-level routines to assist in 
> the management of
> word alignment issues (e.g. memory allocators).
> MISRA rule was changed from should to shall.
> 
> /Flibble

but this MISRA rule makes no sense. Why should you have one file
defining every type that needs to change for each new
platform/compiler ?? Isnt that the whole point of using a compiler
with agnostic type to be defined by it?
By manually doing its job the advice sounds ill to me leading to
err-prone solution. I see how fixed size types can be useful for
embedded/low level routines but for app dev? I rather say no!


-- 
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]

Back to comp.lang.c++.moderated | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Avoid 'int' and associates. Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2015-06-14 06:36 -0600
  Re: Avoid 'int' and associates. Melzzzzz <mel@zzzzz.com> - 2015-06-14 18:00 -0600
  Re: Avoid 'int' and associates. Francis Glassborow <francis.glassborow@btinternet.com> - 2015-06-14 18:07 -0600
  Re: Avoid 'int' and associates. "James K. Lowden" <jklowden@speakeasy.net> - 2015-06-14 18:11 -0600
  Re: Avoid 'int' and associates. James Kuyper <jameskuyper@verizon.net> - 2015-06-14 18:11 -0600
  Re: Avoid 'int' and associates. Maciej Sobczak <see.my.homepage@googlemail.com> - 2015-06-14 18:11 -0600
  Re: Avoid 'int' and associates. Paavo Helde <myfirstname@osa.pri.ee> - 2015-06-14 20:24 -0600
    Re: Avoid 'int' and associates. David Brown <david.brown@hesbynett.no> - 2015-06-15 07:13 -0600
      Re: Avoid 'int' and associates. Francis Glassborow <francis.glassborow@btinternet.com> - 2015-06-15 11:22 -0600
        Re: Avoid 'int' and associates. Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2015-06-15 13:02 -0600
          Re: Avoid 'int' and associates. Francis Glassborow <francis.glassborow@btinternet.com> - 2015-06-15 14:54 -0600
            Re: Avoid 'int' and associates. Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2015-06-15 15:54 -0600
              Re: Avoid 'int' and associates. James Kuyper <jameskuyper@verizon.net> - 2015-06-15 21:04 -0600
                Re: Avoid 'int' and associates. David Brown <david.brown@hesbynett.no> - 2015-06-16 07:05 -0600
                Re: Avoid 'int' and associates. James Kuyper <jameskuyper@verizon.net> - 2015-06-16 14:59 -0600
                Re: Avoid 'int' and associates. David Brown <david.brown@hesbynett.no> - 2015-06-16 16:47 -0600
              Re: Avoid 'int' and associates. scott@slp53.sl.home (Scott Lurndal) - 2015-06-16 09:54 -0600
                Re: Avoid 'int' and associates. legalize+jeeves@mail.xmission.com (Richard) - 2015-06-16 14:59 -0600
                Re: Avoid 'int' and associates. Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2015-06-16 16:47 -0600
              Re: Avoid 'int' and associates. "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-06-16 15:03 -0600
                Re: Avoid 'int' and associates. Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2015-06-16 16:47 -0600
                Re: Avoid 'int' and associates. pip010 <pip010@googlemail.com> - 2015-08-03 06:54 -0600
                Re: Avoid 'int' and associates. maddoxr@acm.org - 2015-08-03 10:01 -0600
            Re: Avoid 'int' and associates. James Kuyper <jameskuyper@verizon.net> - 2015-06-15 21:04 -0600
          Re: Avoid 'int' and associates. James Kuyper <jameskuyper@verizon.net> - 2015-06-15 15:55 -0600
        Re: Avoid 'int' and associates. David Brown <david.brown@hesbynett.no> - 2015-06-16 07:04 -0600
  Re: Avoid 'int' and associates. Öö Tiib <ootiib@hot.ee> - 2015-06-27 14:17 -0600

csiph-web