3 ms·
>- casting away types unsafely is required for many common patterns in C, including any form of runtime polymorphism Which patterns? I'm thinking of stuff like
by madmax96 7y ago
>- casting away types unsafely is required for many common patterns in C, including any form of runtime polymorphism
Which patterns? I'm thinking of stuff like the Berkeley Sockets API, which you can absolutely implement safely.
re numerics: fortunately, that's 100% amenable to static analysis (see -Wconversion, -Wsign-conversion in gcc/clang and coverity's warnings about potentially unsafe casts - e.g. promoting an int to a long is always safe, but an int to a float not necessarily) and follows very straightforward rules.