top | item 44401582

(no title)

wsve | 8 months ago

Sometimes I look at the way C macros are used to simulate generics and wonder to myself... Why don't y'all just put templates into the standard? If the way you're writing C code is by badly imitating C++, then just imitate C++! There's no shame in it!

discuss

order

jimbob45|8 months ago

C++ doesn’t force you to pay for anything you don’t use so you can just use the C++ compiler at that point and change the few incompatibilities between C and C++.

That said…I agree that there is a lot of syntactic sugar that could be added for free to C.

uecker|8 months ago

Maybe you could try to formulate it what sense this approach is actually inferior? IMHO it is superior to C++ templates by being far simpler.