3 ms·
Elsewhere in the plan9 writings, Rob Pike says that he structured it by putting all of the stuff that would need to be ported in one group of files (which expor
by silentbicycle 18y ago
Elsewhere in the plan9 writings, Rob Pike says that he structured it by putting all of the stuff that would need to be ported in one group of files (which export the same interface), conditionally compiling the relevant subset of those, and then writing everything else in terms of those. (A better packaging/namespace system could handle this much more elegantly, though.)
Also, the C preprocessor is largely ignorant of C syntax. Am I the only one who finds that incredibly strange?
- vorador 18y agoWhat would be the advantages of a preprocessor knowing the syntax ?
- silentbicycle 18y agoWhile it probably wouldn't be as useful as Lisp macros, due to the comparatively complex syntax, it would at least avoid bugs involving things like #define macros that evaluate their arguments multiple times. OTOH, not having the C pp tied to C means it can be used for other stuff. The only thing I can think of offhand that uses it is the BSD calendar system, though, and that's largely just #include.
- philwelch 18y agoIf the preprocessor knew the syntax, it would happen after parsing rather than before, which is exactly how every language other than C handles things that C handles using the preprocessor (turning "using" or "include" or "import" into keywords instead of preprocessor directives). I'm really not sure in what way it would be a pre-processor at that point. So perhaps it's more accurate to say preprocessors aren't particularly useful.