Quote:
|
Originally Posted by Alan Anderson
Beauty is in the eye of the beholder. So, apparently, is ugly.  Duff's Device is clever, but it goes back to my old comment about c wanting the programmer to "think like a compiler". Optimizations like this should be done in the compiled code, not the source code.
I guess my discomfort with c boils down to the fact that it's a low-level language in high-level language clothing. It's not far removed from assembly language. I do understand the reason for its being that way. That doesn't mean I have to like it. 
|
it's really a mid-level language. things like Visual Basic are high-level languages, assembly is the ultimate low-level language... C is a mixture of the two. functions, for instance, are above a low level language, as is order of operations, complex conditionals, et cetera. Instead of "having the compiler do all the optimization", however, C takes the route that the ultimate optimizer is the human mind - a compiler can only do so much optimization, but a human can always invent new innovative ways to optimize something.