So, there is no "do not optimize away apperent
volatile variables"?
Volatile variables in shmclient are easily recognized -- at least
I recognized them. It is the array variable which content is only
read but never written.
No such optimization flag? Can't believe that compilers are that dump.
computers are that dumb. and for a good reason. because sometimes,
people are *that* dumb too. people really do write code like:
for (i = 0; i < n; ++i) {
x = y[i];
}
where y is never modified within the compilation unit under
inspection, let alone the scope. what you want is
gcc --fi_am_not_dumb_and_i_mean_what_i_say
the problem then becomes that quite a lot of what you "say" in the
form of C will have to be taken literally by the compiler. it turns
out that very few people on this list (if any) are actually smart
enough to really want the compiler to do that.
you and the compiler need to be friends. you have to communicate, and
to share your strengths. neither of you are stupid, and the compiler
not a slave.
--p