Search code examples
c++ccompilationidepreprocessor

Is the preprocessor IDE only feature?


I tried to do my research but wasn't able to find where preprocessors actually come from - are they part of the IDE's (meaning every IDE has its own implementation of it), standalone programs or part of the compilers?

If they are became part of the modern compilers I imagine it didn't use to be this way historically. How it worked back then?

Thank you


Solution

  • The earliest work on the language that will some years later get the name "C" began in 1969, based on the language BCPL. Preprocessor came to life in 1972.

    The C was at that time still work in progress, so we can say that preprocessor existed since the C itself. There was never a C compiler without the preprocessor.. C++ came to life after C, and it had the preprocessor from the start.

    It's irrelevant if the preprocessor was a separate executable file than the compiler but usually it's a part of the compiler. And no IDEs existed at that time.


    Here's a link where you can read more. This is the part about the preprocessor:

    Many other changes occurred around 1972-3, but the most important was the introduction of the preprocessor, partly at the urging of Alan Snyder [Snyder 74], but also in recognition of the utility of the the file-inclusion mechanisms available in BCPL and PL/I. Its original version was exceedingly simple, and provided only included files and simple string replacements: #include and #define of parameterless macros. Soon thereafter, it was extended, mostly by Mike Lesk and then by John Reiser, to incorporate macros with arguments and conditional compilation. The preprocessor was originally considered an optional adjunct to the language itself. Indeed, for some years, it was not even invoked unless the source program contained a special signal at its beginning. This attitude persisted, and explains both the incomplete integration of the syntax of the preprocessor with the rest of the language and the imprecision of its description in early reference manuals.