Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
worst.c - foolishness
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="Jarno A Wuolijoki, post: 1695899"] Not really. Strings are usually handled through functions and we're not including the important stuff to get complaints. (though in this respect gcc is sometimes one of the "smart compilers" with its built in checking for variadic functions) Ok. Just that the bug's on another line, here we just see the results;) Ouch. I completely unrealized the intent there.. You're approaching the bubble sort: sizeof abuse, off by 2 error had it worked, unsigned gotcha, z vs zz, extra ;, dangerous comparision, sequence point problem on swap, zeroing data when &__a==&__b, invasion of implementation namespace, possible trap when performing binary stuff on chars and modification of a string literal. Nah. It just shows why you shouldn't write bad code in the first place. Mistakes invite more mistakes. It was a genuine;) Subtle.. I don't like the doublecheck for eof though. Checking first for eof and then for errors makes it look better thought out. So it's "hideous practice that lets you shoot your own foot quietly" against "terrible misunderstanding of how the language works" ;) I like !strcmp(strfmt, "foo")==0 too (for having actually seen it), but maybe it's too obvious.. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
worst.c - foolishness
Top