Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #14225

Re: Type interchange

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!newsreader4.netcologne.de!news.netcologne.de!nx02.iad01.newshosting.com!newshosting.com!69.16.185.11.MISMATCH!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!news1.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 Fri, 02 Dec 2011 07:35:55 -0600
Message-ID <4ED8D43C.20B0@mindspring.com> (permalink)
Date Fri, 02 Dec 2011 08:35:56 -0500
From pete <pfiland@mindspring.com>
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 <jb68ju$icb$1@speranza.aioe.org> <4ED6AE65.8050901@verizon.net> <lnbortqjpg.fsf@nuthaus.mib.org> <4ED6C5F0.1080608@verizon.net> <0.041cc3761d33f47105cd.20111201030905GMT.87d3c9ouni.fsf@bsb.me.uk> <jb7r0i$9ku$3@dont-email.me> <4ED7A703.4658@mindspring.com> <lnaa7cos2f.fsf@nuthaus.mib.org> <4ED80320.7A05@mindspring.com> <lnwrafoq1p.fsf@nuthaus.mib.org> <4ED81BD0.4855@mindspring.com> <lnsjl3okkf.fsf@nuthaus.mib.org>
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
Lines 76
X-Usenet-Provider http://www.giganews.com
NNTP-Posting-Host 4.154.219.207
X-Trace sv3-4N3Ov3w91A6xAc4qolSLBJxyvWH0L0rU4y6Aniq9MPGPvJqu5+Yd74s/556HtANJbua7THPpppT0PG2!oN2RqhQIpFXdU1W9RhM8E/7gittmBBcDTdpVEqClU3vBD0qaP8tBeL2HP+790MPZs7Q2IVx23SBO!A4ud9dZrAFc=
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 3909
Xref x330-a1.tempe.blueboxinc.net comp.lang.c:14225

Show key headers only | View raw


Keith Thompson wrote:
> 
> pete <pfiland@mindspring.com> writes:
> > Keith Thompson wrote:
> >> pete <pfiland@mindspring.com> writes:
> >> > Keith Thompson wrote:
> >> >> pete <pfiland@mindspring.com> writes:
> >> >> > James Kuyper wrote:
> >> >> >> Some people prefer to describe this by saying that if there's any
> >> >> >> possible conforming implementation
> >> >> >> where the behavior is undefined, then
> >> >> >> the behavior is undefined, period, even on other implementations where
> >> >> >> the condition that makes it undefined isn't true - but I find that
> >> >> >> interpretation incoherent.
> >> >> >
> >> >> > That way,
> >> >> > whether or not a program contains undefined behavior
> >> >> > is a property of the C program,
> >> >> > and not a property of the
> >> >> > combination of the implementation and C program.
> >> >>
> >> >> int n = 32767;
> >> >> n ++;
> >> >
> >> > The behavior of that code isn't limited by the standard, is it?
> >>
> >> If INT_MAX == 32767, then its behavior is undefined.  Otherwise, its
> >> behavior is well defined (it sets n to 32768).
> >>
> >> The point is that whether or not a program contains undefined
> >> behavior already is "a property of the combination of the
> >> implementation and C program".
> >
> > Whether or not a program is a "strictly conforming program"
> > is not dependant on the implementation,
> 
> Agreed.
> 
> > and whether or not a program is a correct program
> > is not dependant on the implementation.
> 
> Depends on what you mean by "correct".
> 
> > The code that you posted was intended to have a portability issue.
> 
> Of course.
> 
> > A non portable program construct
> > for which the standard imposes no requirements,
> > is what the standard says yields undefined behavior.
> 
> But it doesn't say that *all* uses of nonportable program constructs
> yield undefined behavior.
> 
> 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.

-- 
pete

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Type interchange Edward Rutherford <edward.p.rutherford79@REMOVETHIS.gmail.com> - 2011-11-30 21:53 +0000
  Re: Type interchange James Kuyper <jameskuyper@verizon.net> - 2011-11-30 17:29 -0500
    Re: Type interchange Keith Thompson <kst-u@mib.org> - 2011-11-30 15:22 -0800
      Re: Type interchange James Kuyper <jameskuyper@verizon.net> - 2011-11-30 19:10 -0500
        Re: Type interchange Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-12-01 03:09 +0000
          Re: Type interchange James Kuyper <jameskuyper@verizon.net> - 2011-12-01 07:13 -0500
            Re: Type interchange Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-12-01 15:55 +0000
              Re: Type interchange James Kuyper <jameskuyper@verizon.net> - 2011-12-01 11:28 -0500
                Re: Type interchange Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-12-01 16:45 +0000
                Re: Type interchange James Kuyper <jameskuyper@verizon.net> - 2011-12-01 12:00 -0500
                Re: Type interchange Keith Thompson <kst-u@mib.org> - 2011-12-01 14:31 -0800
                Re: Type interchange James Kuyper <jameskuyper@verizon.net> - 2011-12-01 20:18 -0500
                Re: Type interchange Keith Thompson <kst-u@mib.org> - 2011-12-01 17:35 -0800
                Re: Type interchange James Kuyper <jameskuyper@verizon.net> - 2011-12-02 12:03 -0500
                Re: Type interchange Keith Thompson <kst-u@mib.org> - 2011-12-02 13:49 -0800
                Re: Type interchange James Kuyper <jameskuyper@verizon.net> - 2011-12-02 22:12 -0500
                Re: Type interchange Keith Thompson <kst-u@mib.org> - 2011-12-03 02:01 -0800
                Re: Type interchange Tim Rentsch <txr@alumni.caltech.edu> - 2012-01-25 12:47 -0800
            Re: Type interchange pete <pfiland@mindspring.com> - 2011-12-01 11:10 -0500
              Re: Type interchange James Kuyper <jameskuyper@verizon.net> - 2011-12-01 11:34 -0500
              Re: Type interchange Kaz Kylheku <kaz@kylheku.com> - 2011-12-01 17:48 +0000
              Re: Type interchange Keith Thompson <kst-u@mib.org> - 2011-12-01 14:17 -0800
                Re: Type interchange pete <pfiland@mindspring.com> - 2011-12-01 17:43 -0500
                Re: Type interchange Keith Thompson <kst-u@mib.org> - 2011-12-01 15:00 -0800
                Re: Type interchange pete <pfiland@mindspring.com> - 2011-12-01 19:29 -0500
                Re: Type interchange Keith Thompson <kst-u@mib.org> - 2011-12-01 16:59 -0800
                Re: Type interchange pete <pfiland@mindspring.com> - 2011-12-02 08:35 -0500
                Re: Type interchange James Kuyper <jameskuyper@verizon.net> - 2011-12-02 08:46 -0500
                Re: Type interchange Keith Thompson <kst-u@mib.org> - 2011-12-02 13:32 -0800
                Re: Type interchange Keith Thompson <kst-u@mib.org> - 2011-12-02 13:30 -0800
                Re: Type interchange pete <pfiland@mindspring.com> - 2011-12-02 18:45 -0500
        Re: Type interchange Keith Thompson <kst-u@mib.org> - 2011-11-30 19:17 -0800
          Re: Type interchange James Kuyper <jameskuyper@verizon.net> - 2011-12-01 06:50 -0500
            Re: Type interchange Keith Thompson <kst-u@mib.org> - 2011-12-01 07:15 -0800
              Re: Type interchange James Kuyper <jameskuyper@verizon.net> - 2011-12-01 10:36 -0500
                Re: Type interchange pete <pfiland@mindspring.com> - 2011-12-01 11:04 -0500
                Re: Type interchange James Kuyper <jameskuyper@verizon.net> - 2011-12-01 11:37 -0500
                Re: Type interchange Tim Rentsch <txr@alumni.caltech.edu> - 2012-01-25 13:02 -0800
            Re: Type interchange Tim Rentsch <txr@alumni.caltech.edu> - 2012-01-25 13:01 -0800
    Re: Type interchange Quentin Pope <qp19433@hotmail.NOSPAM.com> - 2011-12-02 22:15 +0000
      Re: Type interchange James Kuyper <jameskuyper@verizon.net> - 2011-12-03 11:39 -0500

csiph-web