At 03:32 PM 6/9/2003 +1200, you wrote:


I'd say the most likely explanation is indeed shimms' and hofer's
conjecture, i.e., that it has not been initialized. There is no serious
compiler that will not follow the left-to-right rule, that's a fairly
integral part of the C++ specification, which is used a lot (it's used
throughout the HL SDK, for example), and certainly they all follow the
correct precedence rules.

Persuter
--


I think it can depend on whether the compiler would use 'full' boolean
logic (where all of a statement is evaluated, even if it's something simple
like 1 && 0), or 'short circuit' (where the code will not evaluate further
if it's obvious what the result will be, like 0 || 0) logic... I know
Delphi (Object Pascal) can use either one, I'm sure C++ ones can too.

As for sticking to a standard, since when has MS started doing that?

Siiiiigh...


C++ uses lazy ("short circuit"), left-to-right evaluation. All serious C++
compilers follow that. Seriously, I can't believe none of you have noticed
this, it is used quite a bit in the HL SDK.

By the way, 0 || 0 is not amenable to short circuit evaluation, since the
first one is not true. I think you meant 0 && 0. And obviously if you
actually put 1 || 0 the compiler will go ahead and evaluate that at
compile-time to true.

Persuter

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders



Reply via email to