News for hackers. Stuff that matters.
Re:Sshole by adgjlsfhk1 on Thursday November 05, 2026 @03:09PM (#50383815)
C is definitely not the most weakly typed (e.g. Javascript/PHP are both weaker), but IMO C is weaker than python in that python will give you a runtime type error if you do something invalid, while in C you cast something and just get UB. Most higher level strongly typed languages are able to make their casts checked because they have generics to remove the need for 99% of them, but C is missing those features and thus has to rely much more heavily on unchecked and unsafe runtime casts.
Re:Sshole by uecker on Thursday November 05, 2026 @04:44PM (#50384876)
Casts are escape hatches just like "unsafe" in Rust. You can write safe generics in C that either do not use casts or wrap all unsafe operations behind type-safe interfaces.