CompuServe Thread

#Stack size calc

5 messages in this thread
#132669From: Scott BallantyneJun 30, 1988 11:26 PM
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
#132671From: John DraperJun 30, 1988 11:37 PM
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
#132802From: Scott BallantyneJul 1, 1988 11:14 PM
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
#132807From: John DraperJul 2, 1988 12:14 AM
Scott, There is a world of difference between optiization of code and having the words 'left to the compiler writer' attached to operations. -larry
#132915From: Scott BallantyneJul 2, 1988 8:11 PM
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