POV-Ray : Newsgroups : povray.general : pov source gcc3 problem : Re: pov source gcc3 problem Server Time
6 Aug 2024 02:25:53 EDT (-0400)
  Re: pov source gcc3 problem  
From: Ron Parker
Date: 3 Aug 2002 12:42:30
Message: <slrnako1vs.rnc.ron.parker@fwi.com>
On Sat, 03 Aug 2002 09:57:43 +0200, Christoph Hormann wrote:
> 
> 
> Warp wrote:
>> 
>> Bob Jamison <rja### [at] lincom-asgcom> wrote:
>> > #ifndef max
>> > #define max(a,b) ( a > b ? a : b )
>> > #endif
>> > #ifndef min
>> > #define min(a,b) ( a < b ? a : b )
>> > #endif
>> 
>> > This is easier than searching & prefacing all max
>> > and min calls with std:: ,  eh?   ;-)
>> 
>>   How is it easier than writing 'using namespace std;' instead?
>> 
>>   Besides, your solution is very bad. Do you know why?
>> 
> 
> Well, i'm no expert in c, but i guess
> 
> max(++x, y)
> 
> would cause problems.

The other problem is precedence.  If a or b are expressions, they'll be
substituted directly into the other expression above.  Some expressions
might not take the substitution so well.  For example, what if you did
max( c==d?c:d, b )

-- 
#macro R(P)z+_(P)_(P)_(P+1)_(P+1)+z#end#macro Q(C,T)bicubic_patch{type 1u_steps
6v_steps 6R(1)R(3)R(5)R(7)pigment{rgb z}}#end#macro _(Y)#local X=asc(substr(C,Y
,1))-65;<T+mod(X,4)div(X,4)9>-2#end#macro O(T)Q("ABEFUQWS",T)Q("WSXTLOJN",T)#
end O(0)O(3)Q("JNKLCGCD",0)light_source{x 1}// ron### [at] povrayorg


Post a reply to this message

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