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: Sender: lang-cpp-request@vandevoorde.com Approved: c.l.c.m@bazarov.com Message-ID: <20150614144835.476dcbbc@maxa-pc> Newsgroups: comp.lang.c++.moderated,comp.lang.c++ From: Melzzzzz Subject: Re: Avoid 'int' and associates. Organization: albasani.net References: 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 On Sun, 14 Jun 2015 06:36:18 CST Mr Flibble 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 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! ]