POV-Ray : Newsgroups : povray.unofficial.patches : Why & has higher precedence than + or - in isosurface functions? : Re: Why & has higher precedence than + or - in isosurface functions? Server Time
2 Sep 2024 06:15:13 EDT (-0400)
  Re: Why & has higher precedence than + or - in isosurface functions?  
From: Vahur Krouverk
Date: 4 Aug 2000 06:25:44
Message: <398A9A4E.24B1018A@aetec.ee>
Warp wrote:
> 
> Dick Balaska <dic### [at] buckosoftcom> wrote:
> : I have also seen #define TRUE ~FALSE
> 
>   This is horrible. It doesn't work!
> 
>   Suppose we have:
> 
> #define FALSE 0
> #define TRUE ~FALSE
> 
>   Then TRUE will be -1 (ie. all bits set).
> 
>   Now suppose we want to add a "boolean" type:
> 
> typedef int BOOL;
> 
>   This will NOT work as it should:
> 
> int x=2, y=2;
> BOOL b;
> 
> b = (x==y);
> 
> if(b == TRUE)
>   puts("Equal");
> else
>   puts("Different");
> 
>   This will print "Different" although x and y are equal.
> 
It is generally not good idea to compare against #define-d TRUE anyhow.
Better is to use != FALSE (although it is not very readable with its
double negative. Fortunately with C++ bool type this shouldn't be issue
any more.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.