Hendrik Visage on Wed, 02 Apr 2003 12:55:23 +0200 (SAST)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[Linux dev] Re: Just a quickie


On Wed, Apr 02, 2003 at 12:36:30PM +0200, Hendrik Visage wrote:
> Good program design (IMO) would be to not use expressions that have
> side effects as demonstrated above, especially if the side effects depends
> or needs the order etc.
> 
>  It's called "second guessing the optimizers", and different optimizers
>  would then handle it differently.

Hmm... got interupted there :(

The point I try to make:

Rather do the following:

$expr1= (horrible stuff and function calls)
$expr2= (ditto or worse)

if ( $expr1 operation $expr2) do_something(); //resultsalways predicatable

as the following:

if ( (horrible stuff and function calls) operation (ditto or worse))
 do_something(); //did it execute all the functions and variable changes??

doesn't necesarily (or not in the right order etc.) execute the expressions
inside the if() statement.

Sometimes also called: Code so that even the diabolic compilers can't
 "mis"understand your code :)

 Hendrik