Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++.moderated > #7278
| Message-ID | <20150614144835.476dcbbc@maxa-pc> (permalink) |
|---|---|
| Newsgroups | comp.lang.c++.moderated, comp.lang.c++ |
| From | Melzzzzz <mel@zzzzz.com> |
| Subject | Re: Avoid 'int' and associates. |
| Organization | albasani.net |
| References | <cZOdnSRj9NsZweHInZ2dnUU7-IudnZ2d@giganews.com> |
| Date | 2015-06-14 18:00 -0600 |
Cross-posted to 2 groups.
On Sun, 14 Jun 2015 06:36:18 CST
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> wrote:
>
> In modern C++ we should avoid using 'int' and its associates such as
> 'short' and 'long' as they are all non-portable and unsafe (their
> size and value range can differ from one implementation to the next);
> instead one should use the typedefs from <cstdint> instead.
>
> A consequence of this rule is that we must never use 'auto' with
> integer literals such as:
>
> auto i = 42;
>
> or
>
> auto i = 42u;
>
> instead we write:
>
> int32_t i = 42;
>
> or
>
> uint32_t i = 42u;
I would never use auto for simple initialization and when types are
obvious (like int), rather I would use auto to avoid long templates.
--
[ 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 | Next — Previous in thread | Next in thread | Find similar
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