Received: by 10.68.251.136 with SMTP id zk8mr33603pbc.1.1354231545308; Thu, 29 Nov 2012 15:25:45 -0800 (PST) Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!kr7no6057933pbb.0!news-out.google.com!s9ni18979pbb.0!nntp.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Thu, 29 Nov 2012 17:25:43 -0600 Message-ID: <50B7EEF8.29B9@mindspring.com> Date: Thu, 29 Nov 2012 18:25:44 -0500 From: pete Reply-To: pfiland@mindspring.com Organization: PF X-Mailer: Mozilla 3.04Gold (WinNT; I) MIME-Version: 1.0 Newsgroups: comp.arch.embedded,comp.lang.c Subject: Re: Getting started with AVR and C References: <22t1b8pt63pcb3fks5ic03tsnlnhlm6ef1@4ax.com> <86boem66on.fsf@gray.siamics.net> <0.4196fd606ae8a0c4ce3e.20121124221204GMT.87zk26y7kb.fsf@bsb.me.uk> <86pq2y1bcy.fsf@gray.siamics.net> Lines: 46 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 4.156.228.57 X-Trace: sv3-1nZpuRlFoSRKR4F8qwkeQUxVuAQjysGrKjK/T6oyafYlFVYZpMpXi/YnW+J7j9/NUtBTwjIfAu8v05p!8iZhemfpKaOGNjTfz/2GGY2DxpJHkybE/i4Uz5zIVGtLXvL5+dL629s7LQHgL4+6ZBeeAaidZsNn!Yccyr4IEqQ== 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: 3081 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Xref: csiph.com comp.arch.embedded:10659 comp.lang.c:28833 James Kuyper wrote: > > On 11/29/2012 09:07 AM, James Kuyper wrote: > ... > > "If an int can represent all values of the original type > > (as restricted > > by the width, for a bit-field), the value is converted to an int; > > otherwise, it is converted to an unsigned int. These are called the > > integer promotions.58) All other types are unchanged by the integer > > promotions." > > (6.3.1.1p2) The first use of "integer promotions" in that > > clause is italicized, which is an ISO convention indicating > > that the > > sentence containing that phrase serves > > as the definition of the phrase. > > I just realized that the meaning of the phrase "All other types" > is not > clear without the preceding part of that clause which I snipped: > > > The following may be used in an expression > > wherever an int or unsigned int may > > be used: > > — An object or expression with an integer type > > (other than int or unsigned int) > > whose integer conversion rank is less than > > or equal to the rank of int and unsigned int. > > — > > A bit-field of type _Bool, int, signed int, or unsigned int. I recall reading some posts in this newsgroup a long time ago, which claimed that under certain circumstances, that it was possible in C99, for unsigned int to promote to type signed int. But that was never the case. In C99 6.3.1.1 paragraph 2, read as "less than" instead of "less than or equal" as you have above; and unsigned int type was covered by "All other types" in the last sentence. -- pete