Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Retarded Coding Standards

Name: Anonymous 2012-06-22 1:20

"Always compare equality with a constant on the left, for example if (5 == maxUsers) instead of if (maxUsers == 5). If neither of the expressions being compared are constants, rewrite the condition so it is, for example if (0 == userCount - userLimit) instead of if (userCount == userLimit)."

"For consistency with the previous rule, non-equality comparisons should also be formatted using the same style. For example, use if (0 < userCount) instead of if (userCount > 0), and if (0 < userCount - userLimit) instead of if (userCount > userLimit)."

Name: Anonymous 2012-06-22 5:55

>>12
GCC does this.

Name: Anonymous 2012-06-22 5:55

>>12
$ cat foo.c
int main()
{
    int x = 0;
    if (x = 1) {}
    return 0;
}
$ gcc -Wall -Wextra foo.c
foo.c: In function ‘main’:
foo.c:4:2: warning: suggest parentheses around assignment used as truth value [-Wparentheses]

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List