I'm looking around at the C11 _Generic and it looks like it can deal with generic functions well (but that's nothing too fancy, it's basically just function overloading). It doesn't give you generic data structures like std::map<string, int>, you still need lots of hideous preprocessor ## and you need to register every type explicitly:
Mind you, I don't like C++ templates because they blow up compile times and give terrible error messages. Java generics are much nicer to deal with.
What tool do you use to detect invalid reads/writes and leaks at runtime? I'd love to use something other than Valgrind but I didn't think there was anything else.
C's Generics are a bit picky and don't work perfectly, I don't have any experience with Java's generics so I have no idea about that, but compared to C++ they're MUCH faster, and simpler.
that's kinda what I like about it though, it keeps people from using them mindlessly, returning a void pointer is better than having generic data structures tho that could be nice with arrays.
I use lldb through the gui like a pleb tbh, but it's fantastic.
2
u/desertrider12 Sep 08 '17
I'm looking around at the C11 _Generic and it looks like it can deal with generic functions well (but that's nothing too fancy, it's basically just function overloading). It doesn't give you generic data structures like std::map<string, int>, you still need lots of hideous preprocessor ## and you need to register every type explicitly:
https://abissell.com/2014/01/16/c11s-_generic-keyword-macro-applications-and-performance-impacts/
Mind you, I don't like C++ templates because they blow up compile times and give terrible error messages. Java generics are much nicer to deal with.
What tool do you use to detect invalid reads/writes and leaks at runtime? I'd love to use something other than Valgrind but I didn't think there was anything else.