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


Groups > comp.lang.c > #14249

Re: Type interchange

Message-ID <4ED96320.79E7@mindspring.com> (permalink)
Date 2011-12-02 18:45 -0500
From pete <pfiland@mindspring.com>
Organization PF
Newsgroups comp.lang.c
Subject Re: Type interchange
References (9 earlier) <lnwrafoq1p.fsf@nuthaus.mib.org> <4ED81BD0.4855@mindspring.com> <lnsjl3okkf.fsf@nuthaus.mib.org> <4ED8D43C.20B0@mindspring.com> <lnfwh2oe50.fsf@nuthaus.mib.org>

Show all headers | View raw


Keith Thompson wrote:
> 
> pete <pfiland@mindspring.com> 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 <stdio.h>
> 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

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