3 ms·
Okay, so you write your own string library. Now you'd like to do the same thing for resizable arrays, so you write a resizable array li… oops, you can't, becaus
by xigoi 4y ago
Okay, so you write your own string library. Now you'd like to do the same thing for resizable arrays, so you write a resizable array li… oops, you can't, because C doesn't have parametric types.
- flohofwoe 4y agoPreprocessor macros are an entirely valid tool in the C language toolbox, even if demonized by C++ coders.
- pjmlp 4y agoEven Macro Assemblers from the MS-DOS and Amiga days are better than C pre-processor macros.
- melagonster 4y agoit is black magic, absolutely respect C developers.
- flohofwoe 4y agoBut the preprocessor is just simple text replacement, nothing magic about it.
- tpoacher 4y agoHe didn't say "write your own library". He said "use" one (your own if you prefer). Or are you going to suggest there are no good string handling libraries for C?
- xigoi 4y agoIt doesn't matter. My point is that it's not possible, not for you and not for anyone else, to implement a type-safe generic resizable array library in C.