5 ms·
This clarifies the need for a more "rust-like" C. I hope something like this will flow into standard C...
by markokrajnc 10y ago
This clarifies the need for a more "rust-like" C. I hope something like this will flow into standard C...
- valarauca1 10y agoI wouldn't bet on it. Every safety feature added to the standard since C99 has been quietly dropped by compiler maintainers. People could write safe code in the 70's. The point of C was to write high level (kinda portable) assembly. Not safety.
- vardump 10y ago> Every safety feature added to the standard since C99 has been quietly dropped by compiler maintainers. Can you give one example of this, please?
- valarauca1 10y agoBounds checking interfaces in C99 Support: GCC: Nope, why? Performance concerns MSVC: Nope, why? Performance concerns Clang/LLVM: Nope, why? Performance concerns. [1] [1] LLVM has the op-codes to implement this, but Clang won't emit those op-codes with the c99 switch triggered.
- vardump 10y ago> Bounds checking interfaces in C99 ... are an optional part of C standard library. C11 Annex K. http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1967.htm http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1967.htm So just use a library for those and you get support in every compiler! > MSVC: Nope, why? Performance concerns MSVC runtime library does support an early version of that. Has supported for over 10 years. They contributed it to the standard, I think. Example, sprintf_s, present in MSVC2005: https://msdn.microsoft.com/en-us/library/ce3zzk1k(v=vs.80).aspx https://msdn.microsoft.com/en-us/library/ce3zzk1k(v=vs.80).a... Anything else?
- yitchelle 10y agoI can't upvote this enough. I started to play with Rust a few months ago and I especially like their compile-time checks of the code. I don't see why C compiler vendors can't do the same thing. Imagine if folks like GreenHills or WindRiver adopt such a practice in their compiler. It would revolutionise their industry. IAR has MISRA-C checks in their compilers but that is not enough.
- jotux 10y agoThere's already an industry providing static analyzers for C (Coverity, Klocwork, Polyspace, etc). If you're doing mission-critical C you're probably using these already.
- yitchelle 10y agoI do, but I wish it was built in, like rustc.
- pcwalton 10y agoBecause the C language is fundamentally hostile to Rust's safety features.
- choosername 10y agowhat about fail quick fail often
- choosername 10y agowhat about fail quick fail often