3 ms·
so C doesn't have proper type safe enums (though you could hack those up with typedef + cpp), but does require casts for most type conversions (except those for
by blibble 13y ago
so C doesn't have proper type safe enums (though you could hack those up with typedef + cpp), but does require casts for most type conversions (except those for void*).
pascal style strings can be done with the preprocessor, as can generic iterators, allocation for idiots, and "out" function arguments.
memory pools are a library feature.
and the arrays are the same too, a pointer in pascal can be treated as an infinitely sized array, but the reverse isn't true, just like in C.
and, believe it or not, there are other languages in the C family, that provide safety in the same way there are for pascal.
tl;dr: pascal and C are more alike than different.
- pjmlp 13y ago> so C doesn't have proper type safe enums (though you could hack those up with typedef + cpp), but does require casts for most type conversions (except those for void*). That still does not make them safe, implicit conversion to int will still happen. > pascal style strings can be done with the preprocessor, as can generic iterators, allocation for idiots, and "out" function arguments. No type safety. > memory pools are a library feature. That aren't part of any C compiler. So you can't count them being available. > and the arrays are the same too, a pointer in pascal can be treated as an infinitely sized array, but the reverse isn't true, just like in C. You lost me there. > and, believe it or not, there are other languages in the C family, that provide safety in the same way there are for pascal. Yes, that is why I use Modern C++, C#, Java, D and will only use C at gunpoint. > tl;dr: pascal and C are more alike than different. True, except in Pascal when bad things happen is because the developer explicitly wanted them to happen. In C everything goes and to have Pascal's safety back, all modern C compilers provide static analyzers. Thus proving a point about the languages design's.