News for hackers. Stuff that matters.
Re:C’s Biggest Mistake (2009) by saagarjha on Sunday September 13, 2020 @06:00AM (#24459738)
> You cannot even use a global variable safely!

Sorry? I’m unsure what you mean here, because there are plenty of ways to use globals in ways I would call “safe”: no undefined behavior, correct output, …

Re:C’s Biggest Mistake (2009) by WalterBright on Sunday September 13, 2020 @04:51PM (#24463861)
In one C file you can declare a global:

    int x;
and in another:

    int* x;
and you'll be mixing pointers and ints and it won't be detected.
Re:C’s Biggest Mistake (2009) by enriquto on Monday September 14, 2020 @01:25PM (#24472690)
I was not talking about this, but about aliasing a variable on the same translation unit.

    int x = 7;
    void f() { /* do things using x */ }
    void insidious_function(int *p) { *p = 3; }
now, inside f you cannot be sure that x equals 7, even if you never write into it. You may call some functions, that in turn call the insidious function that receives the address of x as a parameter. There's no way to be sure that the value of x is not changed, just by looking at your code.