I think you can do so only if every language processor you ever expect to deal with your code is lexically-compatible: you *can't* do so if the lexer will puke: you need some frontend which will prevent the lexer ever seeing the toxin, and that thing is what Lisp would call read-time conditionalization.  Plan 9 and Go both avoid this problem by being single-implementation or nearly-single-implementation systems: many things are easier with that assumption.

On 3 Jan 2017, at 22:12, ron minnich <rminnich@gmail.com> wrote:



On Tue, Jan 3, 2017 at 2:07 PM Lyndon Nerenberg <lyndon@orthanc.ca> wrote:


Plan 9 refreshingly evicted this nonsense from the native compilers (mostly) and the code base.[1]

Yes, You can write portable code without #ifdef, configure scripts, and libtool. Plan 9 shows how.

Some people get upset at mentions of Plan 9, however, so for a more current example, the Go source tree is a good reference. There's no cpp in Go, thank goodness, and they've shown superior portability to systems that revolve around #ifdef.

ron