3 ms·
Well, C++ templates happen on the preprocessor too.
by marcosdumay 5y ago
Well, C++ templates happen on the preprocessor too.
- adrianN 5y agoNo they don't. Template instantiation happens during compilation, way later than the preprocessor.
- kllrnohj 5y agoNot really? They're part of compilation and obey all the type rules & syntax of the language. They're not textual replacements that run in a distinctly different phase like macros are.
- jcelerier 5y agowhere in hell did you learn that, this is entirely false
- __d 5y agoWell, it is today. When I first learned C++, using cfront in the late 80's, lots of the language was implemented as C pre-processor macros.
- jcelerier 5y agomaybe lots of the language, but not templates. Cfront 2 did not have templates, and Cfront 3 did have them without using the preprocessor. You can even check out how it was done: https://github.com/seyko2/cfront-3/blob/master/src/template.C https://github.com/seyko2/cfront-3/blob/master/src/template....