|
|
|
|
|
by srgpqt
1085 days ago
|
|
Even C has a (simple) type system. The problem is that everyone (especially the standard library) take every opportunity to avoid it, instead casting everything to plain void pointers or char pointers. Thus the compiler can’t do much for safety checks. The good news is that you can build typesafe alternatives on top of the underlying std crap. Would be nice to have a standard <stdstruct.h> that provides common typesafe structs for things like os paths, sql strings, html strings, etc. just like <stdint.h> did for sized integers. I’ve rolled my own typesafe wrappers fo my current C project and it’s been great so far. |
|