[Issue 10862] Assignment inside if condition still sometimes accepted

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Aug 21 05:23:10 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10862


monarchdodra at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |monarchdodra at gmail.com


--- Comment #12 from monarchdodra at gmail.com 2013-08-21 05:23:08 PDT ---
(In reply to comment #11)
> (In reply to comment #10)
> > it takes up additional space, so I never do it in my code.
> 
> I'm baffled by this, you say it wastes spaces, yet look at how much space
> you're wasting in std.datetime:
> 
> void _assertPred(string op, L, R)
>                (L lhs, R rhs, lazy string msg = null, string file = __FILE__,
> size_t line = __LINE__)
>     if((op == "<" ||
>         op == "<=" ||
>         op == "==" ||
>         op == "!=" ||
>         op == ">=" ||
>         op == ">") &&
> 
> You've saved one character and wasted 5 lines for a predicate, in a module that
> reaches 34000 lines.

Vertical alignment FTW! Besides... he saved on *6* characters!
     if ((op == "<"  ||
          op == "<=" ||
          op == "==" ||
          op == "!=" ||
          op == ">=" ||
          op == ">") &&

I don't care much about spaces before or after operators (except for people who
put a space between a function name and its empty paren, eg: "doit ()" :puke:).

That said, I'm a real bitch for vertical alignment, as well as clear repeatable
instructions per line. There's something about the result that just makes the
code flow when looking at it.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list