Huh? No, even with the preprocessor, most C/C++ compilers are single-pass. Since both preprocessing and actual compilation require everything to be defined first, they can be single-pass, and the can (and usually are) integrated so that preprocessing is done on the fly. In other words, the preprocessor feeds the compiler tokens, and for macro expansions it feeds it tokens from its token cache.
Originally Posted by abachler
I have no idea what this means.
Single pass compilers have to resolve the definition immediately,
Also wrong. Macros are text (or rather, token) replacements, and the preprocessor doesn't know anything about types.
which limits the definition ostensibly to native types, while a multi pass compiler can resolve the macro in situ, which means it can resolve to the type that is appropriate for the context.
Strange, I know not a single one, unless you count MSC's template instantiation.
All modern C/C++ compilers that I know of are multi-pass.
Inefficient machine code? Nah, optimizers work on an intermediate representation and don't care in the least whether the front-end is single- or multi-pass.
The inefficient code generated by a single pass compilation is now regarded as not worth the increase in speed.
True, see Java.
You can see the legacy of single pass compilation in C/C++'s requirement for forward declaration. This is more or less unnecessary with multi-pass compilers,
Making standard C single-pass-capable was critical to the survival of the language, I'll bet.
but its part of the standard and so can't be changed, which is one reason I am so vocal against adding anything (e.g. the STL) that isn't absolutely critical to the survival of the language to the standard.
I'll also argue that a language without a standard library, i.e. something you can rely on being available, is brutally handicapped.