#Stack size calc
5 messages in this thread
I beg to differ, but C is one of the few languages where you can do something
like
while( dev->regnum < 0)
;
and have the compiler generate what you want. Most other languages will
translate this into something quite different, because the do atomatic
optimization. Things like this have helped to make C such a widespread
systems programming language.
sdb
Scott,
Well, that isn't something that's 'left to the compiler writer', but rather
something that's a function of the optimization in the compiler itself. Given
the same type of optimization, any language will cause that construct to
suffer the same fate. Optimization is not part of the language spec. If it
was, it would be a lot easier to port between compilers.
-larry
Well, you could say the same for the potential rearrangement of equal
precedence operators, that is clearly a compiler optimization as well. If
you include one, seems to me you have to include the other. In any case,
thank goodness you can ask C to give you what you want and usually get it.
Anyway with the yet unofficial Ansi standard and the Volatile keyword you can
get the best of both worlds. sdb
Scott,
There is a world of difference between optiization of code and having the
words 'left to the compiler writer' attached to operations.
-larry
Larry, Perhaps we are not communicating, but I believe it was you who
criticized C for rearranging expressions which are associative and
commutative, this is clearly an optimization. However, if you wish to place
this in the realm of 'left to the compiler writer' options, you have to place
other optimizations there as well.
Even leaving out such issues, asside from function parameter evaluation,
sizeof int and the rest, there is very little thinning 'of the C Bible' by
removing all the 'left to the compiler writer' options.
sdb