News for hackers. Stuff that matters.
Re:C++ in Coders at Work by jacquesm on Friday October 16, 2009 @03:31PM (#886018)
I see it as a traffic problem. I'm not that scared when driving of what I'll do next. But some of the other drivers on that same road scare the willies out of me.

Same with language features. If all you have is bicycles then nobody is going to hurt anybody badly. But if we're all driving rocket cars at 1000 MPh then the resulting pile-ups will be spectacular.

You use operator overloading in a disciplined fashion, because you understand fully what the consequences are when you are using them improperly. If a situation is a 'natural' for overloading then you'll use it, otherwise you'll use a function with a descriptive name.

Unfortunately that is not the norm. You'd almost want an '--expert' flag given to the compiler before you are allowed to use those features, and every time you want to use it you get this trick question about some obscure bug that you have to answer :)

The best little C bug I saw in some forum somewhere by the way was this one:

            int x,y;
    
            x = 0; /* initialize both x
            y = 0;    and y to 0 */
   
            domorestuff(x,y);
Of course any C programmer worth his weight will spot that one in a heartbeat, but it is indicative of how easy a language 'feature' (multiline comments) can become a bug.
Re:C++ in Coders at Work by scott_s on Friday October 16, 2009 @05:13PM (#886184)
That's also an example in favor of why syntax highlighting is a good thing.
Re:C++ in Coders at Work by malkia on Friday October 16, 2009 @06:47PM (#886332)
Nowadays modern C/C++ compilers would complain about that right away (uninitialized-value). Even if you have warnings turned off, then certain compilers would catch this runtime.

And as the below(above?) poster said - there is syntax highlighting. It's not the greatest example of failure.