News for hackers. Stuff that matters.
Re:C Questions and Answers by bgvopg on Wednesday March 04, 2015 @02:05AM (#9143066)
Some would twitch at this:

for(i = length - 1; i < SIZE_MAX ; i--)

but it is completely valid.

Re:C Questions and Answers by joosters on Wednesday March 04, 2015 @04:51AM (#9143445)
The twitchers are right. Whoever wrote that line of code is a smartass who is deliberately obfuscating stuff. Don't work with these people!
Re:C Questions and Answers by bgvopg on Wednesday March 04, 2015 @04:52PM (#9147605)
I prefer to learn, rather than stay ignorant, when I find new tech.

The only people I would not want to work with are ignoramuses and ironically, smart-asses. So you.

Re:C Questions and Answers by anon4 on Wednesday March 04, 2015 @02:47AM (#9143166)
just fucking use

  for(i = 0; i < length; i++)
    .. do something with (length - i - 1) ..
I've been much happier since I started writing all loops as incrementing loops.
Re:C Questions and Answers by cbsmith on Wednesday March 04, 2015 @03:03AM (#9143199)

    for (i = 0; i <= length; i++)
        .. boy I sure hope length is not a max value ..
It's not about the incrementing vs. decrementing so much as the equality bounded loop on a value that could be a min/max value. Gets you every time.
Re:C Questions and Answers by astrange on Wednesday March 04, 2015 @02:57AM (#9143191)
Assuming, of course, i is size_t and not int.
Re:C Questions and Answers by bgvopg on Wednesday March 04, 2015 @03:18AM (#9143225)
My reply to kdoherty isn't assuming that. Read the parent carefully.
Re:C Questions and Answers by heinrich5991 on Wednesday March 04, 2015 @04:25AM (#9143385)
I don't see it, can you explain why this works with `int`?
Re:C Questions and Answers by Ded7xSEoPKYNsDd on Wednesday March 04, 2015 @06:13AM (#9143623)
It doesn't work for int, but kdoherty specified unsigned int.