[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: changing "configure" to default to "gcc -g -O2 -fwrapv ..."
From: |
Paul Eggert |
Subject: |
Re: changing "configure" to default to "gcc -g -O2 -fwrapv ..." |
Date: |
Sat, 30 Dec 2006 21:52:24 -0800 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux) |
address@hidden (Richard Kenner) writes:
> I found my copy of K&R (Second Edition)....
Robert Dewar <address@hidden> writes:
> so in fact the new C standard has changed
> nothing from a definitional point of view,
Wait, though: K&Rv2 is post-C89. If memory serves, it was C89
that established the rule that signed integer overflow has
undefined behavior whereas unsigned overflow is well-defined.
Naturally K&Rv2 documents this, but if you want to know about
traditional practice the relevant wording should come from K&Rv1,
not v2.
I don't know what K&Rv1 says on the subject, but from other
evidence it's clear that common traditional practice assumes wrapv
semantics. I just now looked at the implementation of atoi() in
7th Edition Unix, which is about as traditional as it gets. It
ends as follows:
while(*p >= '0' && *p <= '9')
n = n*10 + *p++ - '0';
return(f? -n: n);
where p is char* and n is int. This relies on wrapv semantics
when atoi returns INT_MIN. I'm sure many similar examples can be
found in the V7 sources.
Re: changing "configure" to default to "gcc -g -O2 -fwrapv ...", Robert Dewar, 2006/12/30
Re: changing "configure" to default to "gcc -g -O2 -fwrapv ...", Robert Dewar, 2006/12/30
Re: changing "configure" to default to "gcc -g -O2 -fwrapv ...", Gabriel Dos Reis, 2006/12/31
Re: changing "configure" to default to "gcc -g -O2 -fwrapv ...", Richard Kenner, 2006/12/31
Re: changing "configure" to default to "gcc -g -O2 -fwrapv ...", Robert Dewar, 2006/12/31
Re: changing "configure" to default to "gcc -g -O2 -fwrapv ...", Richard Kenner, 2006/12/31
Re: changing "configure" to default to "gcc -g -O2 -fwrapv ...", Robert Dewar, 2006/12/31
Re: changing "configure" to default to "gcc -g -O2 -fwrapv ...", Richard Kenner, 2006/12/31
Re: changing "configure" to default to "gcc -g -O2 -fwrapv ...", Gabriel Dos Reis, 2006/12/31