On Sat, Aug 21, 2010 at 00:00, div0
<div0@sourceforge.net> wrote:
On 20/08/2010 21:16, Jonathan M Davis wrote:
It's legal according to TDPL. It seems to be intended to be used as a shorthand
for if. So, stuff like
condition&& writeln("my output");
are supposed to be perfectly legal as bizarre as that may seem. I don't believe
that it would be legal to do
if(condition&& writeln("my output"))
{
}
since the result fed to if must be a bool, but a statement doesn't need to
result in bool, so apparently you can use&& with a void function in a
statement. It's just that the void function must be last.
- Jonathan M Davis
Then Andrei has taken leave of his senses and this is one situation where DMD is corrent and TDPL is wrong.
Half arsed, moronic shortcuts like that belong in scripting languages and shell environements, not serious programming languages.
If Andrei is wrond and DMD is right, then the first example should not have compiled too..