Optional braces

Marco Leise Marco.Leise at gmx.de
Fri Aug 26 03:39:26 PDT 2011


Am 26.08.2011, 11:32 Uhr, schrieb bearophile <bearophileHUGS at lycos.com>:

> There is one more special case that we plan to disallow, that's not in  
> DMD yet:
>
> 5409 Disallow (!x & y)
> http://d.puremagic.com/issues/show_bug.cgi?id=5409

Is (!x & y) an issue or is it rather people omitting spaces in their code  
!x&y ? I can't imagine anyone will assume that !x & y negates the whole  
expression. At least a kernel developer should know the operator  
precedence. Are there actually lots of kernel bugs related to the version  
with spaces?
I think the warning you get in many languages/IDEs when you write "if (x =  
y)" is ok. It tells you to wrap that expression in parenthesis if you  
really meant to do an assignment. It is a very special case that is not  
common among all imperative languages and is easily overlooked, especially  
if you worked with a language that uses = for comparisons.
If in the above case we are forced to write ((!x) & y) that's ... LISP. At  
least I'm not convinced by what is in the bug report.


More information about the Digitalmars-d mailing list