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: Miscompilation of remainder expressions


Paolo Carlini writes:
 > Andrew Haley wrote:
 > 
 > > > Ok, I believe you. However, isn't true that, in general, because the 
 > > > sign of the result is implementation defined,
 > >
 > >The sign of the result of % is no longer (since C99) implementation-
 > >defined.
 > >  
 > >
 > I see. However, by default, I'm always talking about C++03...

I just had a look at that, and it seems that they haven't yet adopted
the tightening-up of the langauge used by C.  However, the footnote
says:

"74) According to work underway toward the revision of ISO C, the
preferred algorithm for integer division follows the rules defined in
the ISO Fortran standard, ISO/IEC 1539:1991, in which the quotient is
always rounded toward zero."

It would be a very brave developer who chose to do anything different.

Andrew.


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