4 ms·
You can keep C syntax in your head. But that's the problem with C. It looks like a simple language with a small number of straightforward constructs, when in f
by TheOtherHobbes 5y ago
You can keep C syntax in your head.
But that's the problem with C. It looks like a simple language with a small number of straightforward constructs, when in fact it has very poor predictability.
Real-world results are implementation and platform-dependent, which is a polite way of saying they're unhelpfully unpredictable.
Coding standards will help, but they only get you so far because some ambiguities will always be there.
Basically C is a half-assed wrapper around assembler - useful in its day, but machine-dependent and outdated now.
- jstanley 5y ago> You can keep C syntax in your head. You can keep the syntax and all the useful parts of the standard library in your head.
- wheelerof4te 5y agoThat is indeed helpful. A lot of modern languages sacrificed simplicity for features no one (with enough skill) asked. Even with Python, I can only keep some part of built-in functions and methods together with syntax in my head. For a large part of standard library, I absolutely need IDE features. Especially since Python is an object oriented language where every data instance has a bunch of methods attached.
- gjulianm 5y agoI have been coding some time in C (and some of that doing kernel drivers), and I don't think I've ever found "unhelpfully unpredictable" behavior in regular code. The "coding standard" that gets rid of those is "if it looks weird, it goes away". I've seen quite a lot of talk about the problems of undefined behavior but I haven't actually faced those problems in the wild.
- pjmlp 5y agoI suggest doing code review of offshored code delivered by sweep shop consultancies, you will find plenty of it.
- sigstoat 5y agohot tip: those folks don't produce good code in any language, don't blame it on C.
- pjmlp 5y agoRight, https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=memory+corruption https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=memory+corr...
- sigstoat 5y agoif you wanted to say "C makes it possible/easy/likely to have memory errors", i wouldn't have said anything. you drug in "offshored code delivered by sweep shop consultancies", got a response, and then move the goalposts. go away.
- pjmlp 5y agoI am not going anywhere. You were the one asserting that it only happens in sweetshops, hence my remark wasn't valid, thus I decided to broaden the scope of people failing to write C. Those mythical C developers that are yet to be found after 50 years searching for them.
- dzaima 5y agoUsing C is a tradeoff. I personally wouldn't write unsandboxed mission-critical code that has to interpret untrusted remote user input in C. But for anything that's not that, the freedom it gives over everything is awesome, and it makes many things possible to do trivially that would be nigh impossible in most other languages (at least not while keeping around any of their properties of safety). But, it is, in fact, possible for good developers to write incorrect C code. Noone's claiming that's not the case. It's just a lot less likely for someone who actually knows the language and the codebase.
- incompleteCode 5y ago
- SteveMoody73 5y agoIn the embedded world where there are a lot of C compilers, it's not so much the language you keep in your head but the compiler implementation of the language. I'm in the process of moving an old codebase from a compiler with a very loose adherence to an old specification to an ARM chip that is using GCC for the compiler. Enabling -Wall to catch all issues that the compiler highlighted, 16-bit ints to 32-bit ints, and quite a few ternary operator issues. None of these were issues on a system that's been running in production for many years but porting to a new architecture will mean there’s a lot of extra testing to be done just to make sure we catch all the edge cases in the code. I like the C language and have been using it for close to 30 years now. The main part of the language can be kept in your head but there is so much more to working with it than just the base language.