Boost logo

Boost :

From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2002-12-13 11:11:41

On Thu, 12 Dec 2002 17:52:58 -0800, "Paul Mensonides"
<pmenso57_at_[hidden]> wrote:

>> >Does it only emit a warning for modulus by zero too?
>> Yes. I don't know about Kylix but all the other flavours of Borland
>> C++ just give W8082 for both / and %, in constant expressions (by
>> default; of course you can even disable it with -w-zdi or -w-8082)
>Does it yield true or false? I.e. what happens here:
>#if 1 / 0
>section 1
>section 2
>I don't see how it could logically choose, since 1 / 0 makes no sense.

I don't know if the behaviour is documented. As far as I have seen
constant / 0 just yields constant (same thing for constant % 0,
however in this case at least it could make sense as a convention). I
feel from your words you don't believe me but... that's the truth! :-)
And there's even another absurdity: you don't have a warning in non
constant expressions, even if the divisor is constant.

   int main() {

     int a = 5;
     const int b = 5;

     a/0; // no warning here



Boost list run by bdawes at, gregod at, cpdaniel at, john at