POV-Ray : Newsgroups : povray.off-topic : Games programmers : Re: Games programmers Server Time
10 Oct 2024 17:18:41 EDT (-0400)
  Re: Games programmers  
From: andrel
Date: 12 Sep 2008 14:36:29
Message: <48CAB6F3.7010009@hotmail.com>
On 12-Sep-08 20:02, Orchid XP v8 wrote:
> Gail wrote:
> 
>> How often does a C/C++ programmer really need a function pointer?
> 
> Hopefully very rarely...
> 
>>> Which one is FALSE? Is that 0 or 1? I know it's one or the other, but 
>>> I can never ever remember which - and it's kind of important!
>>
>> 0. Any other value is true.
> 
> I remember that 0 is one thing and everything else is the opposite. But 
> I can never remember which is which.

It's easy, booleans are a sort of integers following the normal 
convention that 0 is false and 1 is true. That any other value also 
works comes from the fact that most processors have a zero flag that you 
can conditionally jump on. Another example of hardware influencing the 
language.

AFAIK the only place where this convention is not used is in shell 
scripts in UN*X. Here the reason is that they are originally not 
booleans but error codes.

At least that is how I think where the conventions come from. Anyone 
more knowledgeable can correct me.


Post a reply to this message

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