Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.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: Fri, 02 Dec 2011 17:45:33 -0600 Message-ID: <4ED96320.79E7@mindspring.com> Date: Fri, 02 Dec 2011 18:45:36 -0500 From: pete Reply-To: pfiland@mindspring.com Organization: PF X-Mailer: Mozilla 3.04Gold (WinNT; I) MIME-Version: 1.0 Newsgroups: comp.lang.c Subject: Re: Type interchange References: <4ED6AE65.8050901@verizon.net> <4ED6C5F0.1080608@verizon.net> <0.041cc3761d33f47105cd.20111201030905GMT.87d3c9ouni.fsf@bsb.me.uk> <4ED7A703.4658@mindspring.com> <4ED80320.7A05@mindspring.com> <4ED81BD0.4855@mindspring.com> <4ED8D43C.20B0@mindspring.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 52 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 4.154.218.218 X-Trace: sv3-wSkbThObnT6ZXC3fQ43/mf2S0mrlp7acF1up/jZFIxM4wnfGiKDyDaL5m4rKW1MLMqCUTGByeLruOZe!57Pp2Tsjb7R6ROd6QLN+ZqeOk8R61hnsHqPWLlfaaglWqnlK7NzPci9k0Sq1mo6lsW2YTFGT7acA!OliR2bNuEFw= 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: 2878 Xref: x330-a1.tempe.blueboxinc.net comp.lang.c:14249 Keith Thompson wrote: > > pete writes: > > Keith Thompson wrote: > [...] > >> Let's make it a complete program: > >> > >> int main(void) { > >> int n = 32767; > >> n ++; > >> return 0; > >> } > >> > >> I say that this program (specifically its execution) has undefined > >> behavior under an implementation with INT_MAX == 32767, and has > >> well defined behavior under an implementation with INT_MAX > 32767. > >> > >> What do you say? Are you claiming that the program's behavior is > >> undefined regardless of the implementation? > > > > Yes. > > > > That's an example of a non portable construct > > for which the standard imposes no requirements. > > And that's where I think you're wrong. It's a non-portable construct > for which the standard *does* impose a requirement. The requirement is > that if INT_MAX > 32767, then the value of n after "n ++;" shall be > 32768. > > Given a revised program: > > #include > int main(void) { > int n = 32767; > n ++; > printf("n = %d\n", n); > return 0; > } > > do you believe that, on an implementation with INT_MAX > 32767, > and in the absence of I/O errors, that program can do anything > other than printing "n = 32768"? No. > A conditional requirement is still a requirement. I'm starting to see things your way. -- pete