On Sat, Jun 6, 2020 at 3:50 PM Doug McIlroy <doug(a)cs.dartmouth.edu> wrote:
Steve
Johnson's position paper on optimising compilers may amuse you:
https://dl.acm.org/doi/abs/10.1145/567532.567542
Indeed. This passage struck a particular chord:
"I contend that the class of applications that depend on, for example, loop
optimization and dead code elimination for their efficient solution is of
modest size, growing smaller, and often very susceptible to expression in
applicative languages where the optimization is built into the individual
applicative operators."
I don't know whether I saw that note at the time, but since then I've
come to believe, particularly in regard to C, that one case of dead-code
elmination should be guaranteed. That case is if(0), where 0 is the
value of a constant expression.
This guarantee would take the place of many--possibly even
most--ifdefs. Every ifdef is an ugly intrusion and a pain to read.
Syntactically it occurs at top level completely out of sync with the
indentation and flow of text. Conversion to if would be a big win.
I'd love something like this to work, but the semantic interpretation would
need to also somehow be omitted, otherwise how do you replace
#ifdef AIX
ioct(fd, AIX_SPECIFIC_IOCTL, ...)
#endif
on a HUPX system that doesn't define AIX_SPECIFIC_IOCTL...
I remember hearing that BLISS could cope because it deferred the semantic
interpretation of the identifiers until after a round of dead code
elimination so it didn't need a pre-processor...
Warner