News for hackers. Stuff that matters.
Re:Moving the Linux Kernel to Modern C by marcosdumay on Thursday February 24, 2022 @09:38PM (#30463142)
Well, C++ templates happen on the preprocessor too.
Re:Moving the Linux Kernel to Modern C by adrianN on Thursday February 24, 2022 @11:56PM (#30463858)
No they don't. Template instantiation happens during compilation, way later than the preprocessor.
Re:Moving the Linux Kernel to Modern C by kllrnohj on Thursday February 24, 2022 @10:02PM (#30463277)
Not 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.
Re:Moving the Linux Kernel to Modern C by jcelerier on Friday February 25, 2022 @05:41AM (#30465794)
where in hell did you learn that, this is entirely false
Re:Moving the Linux Kernel to Modern C by __d on Friday February 25, 2022 @07:34AM (#30466607)
Well, 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.

Re:Moving the Linux Kernel to Modern C by jcelerier on Friday February 25, 2022 @07:45AM (#30466678)
maybe 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....