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 8:28

>>19
That should still fail in C# because 'x = false' is not an expression.

And, lo and behold, with Mono (gmcs), this code:
using System;

namespace Scalable.Enterprise {
    class Module {
        public static void Main(string[] args)
        {
            bool ScalableEnterpriseBoolean = true;
            if (ScalableEnterpriseBoolean = false)
                Console.WriteLine("``faggot''");
        }
    }
}

gives these warnings:
gmcs -out:ScalableEnterpriseModule.exe ScalableEnterpriseModule.cs
ScalableEnterpriseModule.cs(8,55): warning CS0665: Assignment in conditional expression is always constant. Did you mean to use `==' instead ?
ScalableEnterpriseModule.cs(7,30): warning CS0219: The variable `ScalableEnterpriseBoolean' is assigned but its value is never used
Compilation succeeded - 2 warning(s)

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