[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-patches
Subject:    Re: PR 21438 : Warning about division by zero depends on lexical  form
From:       Gabriel Dos Reis <gdr () cs ! tamu ! edu>
Date:       2007-01-30 0:42:26
Message-ID: 87k5z5e45p.fsf () soliton ! cs ! tamu ! edu
[Download RAW message or body]

Mark Mitchell <mark@codesourcery.com> writes:

| Manuel López-Ibáñez wrote:
| > On 29/01/07, Mark Mitchell <mark@codesourcery.com> wrote:
| >> > The C++ front-end, on the contrary, warns always. Is this an
| >> inconsistency?
| >>
| >> Yes, I think the two front ends should behave the same in this respect.
| >>
| > OK but what is the desired behaviour?
| 
| Heh. :-)
| 
| I'm not sure.  We have __builtin_nan() for generating NaNs, and C99 has
| a NAN macro, which, IIUC, should be implemented as a call to
| __builtin_nan() in the C library, if designed for use with GCC.  So, one
| point of view is that we don't need to special-case 0.0 / 0.0, and that
| we should warn about that too.  On the other hand, lots of code
| (including code designed for older versions of GCC or other compilers)
| may do that as a way of getting a NaN.

Yes.  I seem to remember the old version libstdc++ that generated
numeric_limits<> did something similar to get a NaN.

-- Gaby

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic