Re:The libkern C++ Runtime
by kjgkjhfkjf on Wednesday July 11, 2018 @08:15PM
(#17511264)
Hand-coding multiple versions of a function or class to accommodate various types would be just as bad in terms of code size, no? Plus it'd be tedious and error-prone to do this.
[ Parent
| on HN ]
Re:The libkern C++ Runtime
by Negitivefrags on Wednesday July 11, 2018 @09:07PM
(#17511486)
In practice most of the time you would just write a generic version using one of the other mechanisms. Virtual functions, void* and casting, type ids, or whatever.
Just like everything else, it's a time/space tradeoff because it generates less optimal code in exchange for a smaller binary size.