This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: signed is undefined and has been since 1992 (in GCC)


Gabriel Dos Reis wrote:

The issue here is whether if the hardware consistently display a
semantics, GCC should not allow access to that consistent semantics
under the name that "the standard says it is undefined behaviour".
Consider the case of converting a void* to a F*, where F is a function
type.

Well the "hardware consistently displaying a semantics" is not so cut and dried as you think (consider the loop instruction and other arithmetic on the x86 for instance in the context of generating code for loops).

THis is all about trading off undefined behavior (a bad thing) against
high performance (a good thing) against encouraging people to write
portable code (a good thing) against existing wrong programs working
(probably a good thing, though at odds with the portability requirement).

C is not a way of writing machine code, it is an abstract language
defined by the standard. There can be arguyments for language extension,
as you making, but such decisions should be made with proper data about
the magnitude of the tradeoffs.

-- Gaby



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]