On 29-Jul-99 Dan Mueth wrote:
>>
>> Ohh, I see some other purists :) For the if ... then ... else ... expression
>> of Dan I would have got a bunch of - points in my university tests :) You'll
>> learn when getting bad votes :)
>
> If I may explain what I was thinking:
> 1) the current code always uses true and false, not 1 and 0, so
> I chose to keep the convention of the original author
> 2) If somebody decided to redefine true to 0 and false to 1,
> then I think my code would be the more robust.
>
> Actually, I don't even know where true and false are defined. I'm
> guessing they are in some header file somewhere which somebody could
> conceivably change. Is this right?
>
> Woops. In this case, I guess I should have used:
> if (color_visual == true)
No the "if (color_visual)" was very right! The above would be not wrong, but
ugly :)
>
> I'm still learning here. Which way is better?
>
Hi Dan!
I was just joking :), but what I meant is that if you have code like this:
if (expr())
then
var=true;
else
var=false;
then you should use an assignment expression, like:
var = expr();
instead.
Hope this helps you to understand what I was speaking of :)
Greets Jürgen
P.S.: Your code is working in any way this is just esthetics :)
-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._
Dr. Jürgen Vigna E-Mail: [EMAIL PROTECTED]
Gerbergasse 60 Tel: +39-0471-450260
I-39100 Bozen Fax: +39-0471-970042
ITALY Web: http://www.sad.it/~jug
If you are a fatalist, what can you do about it?
-- Ann Edwards-Duff
-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._