ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

The Top 10 Ways to get screwed by the "C" programming language - old but good

<< < (2/2)

Eóin:
Accidental assignment/Accidental Booleans
        if(a=b) c;

--- End quote ---
I think that's one of those everyone did at some point!
-jgpaiva (July 26, 2006, 03:06 PM)
--- End quote ---
I had one of those errors recently. It took the addition of a serious lot of logging code to track down where the error was originating, needless to say when I discovered it was a simple typo I was fit to scream :-[ .

f0dder:
But... "if(a=b) c;" could make sense in "if(a=malloc(FOOBAR) c;"... if you like terse code anyway.

jgpaiva:
But... "if(a=b) c;" could make sense in "if(a=malloc(FOOBAR) c;"... if you like terse code anyway.
-f0dder (July 26, 2006, 03:29 PM)
--- End quote ---
:) Sure, i already did some code like that, it can be useful. (althought it tends to generate spaghetti-code).
What i meant is that being it a typo or not (sometimes when you're using to different languages at the same time you don't have time to get in the mood of the other one), i think everybody already did that small slip.

Navigation

[0] Message Index

[*] Previous page

Go to full version