| ▲ | flohofwoe 2 hours ago | |||||||
> So in C typically you'd have a runtime generic routine that doesn't inline. With LTO you get many of the same advantages as C++ template code, there's nothing magic about C++ template optimizations, it's all about whether the compiler can see all function bodies in a call hierarchy. | ||||||||
| ▲ | simonask an hour ago | parent [-] | |||||||
LTO cannot change the layout of structs. For something like a hash map implementation, it matters whether inner nodes store a pointer to the key and value, or whether it stores a pointer to each. To achieve this in C, you have no other options than emulating templates using macros. | ||||||||
| ||||||||