Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++.moderated > #7278
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!Xl.tags.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!news.giganews.com.POSTED!not-for-mail |
|---|---|
| NNTP-Posting-Date | Sun, 14 Jun 2015 18:10:02 -0500 |
| Return-Path | <cppmods@glengoyne.dreamhost.com> |
| Sender | lang-cpp-request@vandevoorde.com |
| Approved | c.l.c.m@bazarov.com |
| 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> |
| Content-Type | text/plain; charset=US-ASCII |
| X-Original-Date | Sun, 14 Jun 2015 14:48:35 +0200 |
| X-Submission-Address | lang-cpp-submit@vandevoorde.com |
| Date | Sun, 14 Jun 2015 18:00:22 CST |
| Lines | 36 |
| X-Usenet-Provider | http://www.giganews.com |
| X-Trace | sv3-kfkkzdGjMPRC/dVj7OFiQOCLMbJVs3EJR68Vikt54C4ywWMvE91+oceImZx2JvINMQ+/EIu3R+z/6dB!Q+0A6Yc9P0d0F5jWSUqU7/vunzbuMbfyELUwwL9z4haw4FGLH3OXKbMRHA== |
| X-Complaints-To | abuse@giganews.com |
| X-DMCA-Notifications | http://www.giganews.com/info/dmca.html |
| X-Abuse-and-DMCA-Info | Please be sure to forward a copy of ALL headers |
| X-Abuse-and-DMCA-Info | Otherwise we will be unable to process your complaint properly |
| X-Postfilter | 1.3.40 |
| X-Original-Bytes | 2082 |
| Xref | csiph.com comp.lang.c++.moderated:7278 comp.lang.c++:36356 |
Cross-posted to 2 groups.
Show key headers only | View raw
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