Re:C-for-all: Extending C with modern safety and productivit...
by madmax96 on Wednesday December 04, 2019 @07:08AM
(#21701483)
>- 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.
- casting away types unsafely is required for many common patterns in C, including any form of runtime polymorphism
- basically anything involving numerics has a good chance of happily casting for you without asking you or telling you