2 ms·
Correct, but also beside the point. To do it in almost-plain C, you'd need fairly complex macros that are more difficult to write correctly. To do it in plain
by windenntw 18d ago
Correct, but also beside the point.
To do it in almost-plain C, you'd need fairly complex macros that are more difficult to write correctly.
To do it in plain C without macros, or plain C++ without templates... you'd need to work out the combination of the template expansion yourself and write down a piece of code that is more likely to have bugs and more difficult to understand.
- eru 18d agoI'm not quite sure: you could probably use plain C functions, and a reasonably smart compiler could see through it all and inline and duplicate and merge the code as necessary. EDIT: I just had an AI agent run the experiment. At least for my version of clang, they produce the same assembly for x86_64 (modulo using slightly different registers).