←back to thread

The provenance memory model for C

(gustedt.wordpress.com)
224 points HexDecOctBin | 1 comments | | HN request time: 0.205s | source
Show context
jvanderbot ◴[] No.44422693[source]
I love Rust, but I miss C. If C can be updated to make it generally socially acceptable for new projects, I'd happily go back for some decent subset of things I do. However, there's a lot of anxiety and even angst around using C in production code.
replies(6): >>44422779 #>>44423128 #>>44423371 #>>44423771 #>>44425323 #>>44433479 #
mikewarot ◴[] No.44422779[source]
If you can stomach the occasional Begin and End, and a far less confusing pointer syntax, Pascal might be the language for you. Free Pascal has some great string handling, so you never have to worry about allocating and freeing them, and they can store gigabytes of text, even Unicode. ;-)
replies(2): >>44422784 #>>44422867 #
jvanderbot ◴[] No.44422867[source]
If my fellow devs cringe at C, imagine their reaction to Pascal
replies(1): >>44423210 #
mikewarot ◴[] No.44423210[source]
C has all the things to hate in a programming language

  CaSe Sensitivity
  Weird pointer syntax
  Lack of a separate assignment token
  Null terminated strings
  Macros - the evil scourge of the universe
On the plus side, it's installed everywhere, and it's not indent sensitive
replies(5): >>44423261 #>>44424125 #>>44424253 #>>44424648 #>>44430684 #
1718627440 ◴[] No.44424253[source]
> Lack of a separate assignment token

What does that mean?

replies(1): >>44424637 #
kbolino ◴[] No.44424637[source]
Assignment is = which is too close to equality == and thus has been the source of bugs in the past, especially since C treats assignment as an expression and coerces lots of non-boolean values to true/false wherever a condition is expected (if, while, for). Most compilers warn about this at least nowadays.
replies(1): >>44427573 #
1. tialaramex ◴[] No.44427573[source]
Even with warnings this is just terrible. People need to stop inventing languages where "False" is true, or an empty container is false or other insane "coercions" of this kind.

True is true, and false is false, if you're wondering whether this Doodad is Wibbly, you should ask that question not rely on a convention that Wibbly Doodads are somehow "truthy" while the non-Wibbly ones are not.