[SLUG] GCC -- anomaly or feature?

From: Ed Centanni (ecentan1@tampabay.rr.com)
Date: Wed Aug 15 2001 - 18:33:58 EDT


I found out today that when you call a function with functions as
arguments:

DoThisThing(with1(thing), with2(thing), with3(thing));

the "with" functions do not get called in left to right (1,2,3) order.
I had to break them out thus:

int a = with1(thing);
int b = with2(thing);
int c = with3(thing);
DoThisThing(a,b,c);

to ensure that the functions were called in the right order.

My question is: Is there a compiler option that forces the arguments to
be evaluated in the desired (left-to-right) order. I tried -O0 (that's
dash oh zero -- no optimizations) and the always popular
-fno-defer-pop. No joy. BTW, that last one is NOT a compiler option
to tell gcc to dis your dad.

Also, "thing" is a pointer to a pointer that get modified (advanced down
a string) on each "with" invocation. I know it's not good form but I
have to deal with some existing code.

TIA
Ed.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 19:28:49 EDT