|
![](/i/fill.gif) |
On Sat, 03 Aug 2002 09:57:43 +0200, Christoph Hormann wrote:
>
>
> Warp wrote:
>>
>> Bob Jamison <rja### [at] lincom-asg com> 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] povray org
Post a reply to this message
|
![](/i/fill.gif) |