3 ms·
On the topic of (overly) aggressively optimising compilers: http://blog.metaobject.com/2014/04/cc-osmartass.html http://blog.metaobject.com/2014/04/cc-osmartas
by userbinator 12y ago
On the topic of (overly) aggressively optimising compilers:
http://blog.metaobject.com/2014/04/cc-osmartass.html http://blog.metaobject.com/2014/04/cc-osmartass.html
...and attempts at turning C into something a bit less programmer-hostile:
https://news.ycombinator.com/item?id=8233484 https://news.ycombinator.com/item?id=8233484
My point of view is that compilers should be optimising at the level of machine instructions, not by attempting to second-guess the programmer and remove code that it thinks invokes UB. I've looked at tons of compiler output over the years, and there's plenty of opportunity for optimisation in instruction selection and register allocation... C should be a "do what I say, not what I mean" type of language.
- xenadu02 12y agoMeh, the problem is the preprocessor. A lot of really silly things are produced by macro expansion, so the "obviously silly" optimizations really do end up mattering.
- pmr_ 12y agoThat sounds interesting, but I'm suspicious. Do you have any examples of such macros and maybe some statistics or ideas how often they are actually seen in the wild?
- eatonphil 12y agoThere are also libraries such as libCello[0] and Viola[1] (mine) to really simplify C through macros. libCello is some really cool stuff. [0] http://libcello.org/ http://libcello.org/ [1] https://github.com/eatonphil/viola https://github.com/eatonphil/viola
- pjc50 12y agoI have a set of incomplete notes headed "typesafe object orientated macro assembler?" which is my thinking on this question. I think that captures what people want: optimal direction of the machine, with all modern conveniences and automated error prevention.