What the hell is wrong with D?

Ali Çehreli acehreli at yahoo.com
Tue Sep 19 18:44:03 UTC 2017


On 09/19/2017 11:34 AM, Brad Anderson wrote:
 > On Tuesday, 19 September 2017 at 18:17:47 UTC, jmh530 wrote:

 >> Pretty sure it would be exactly the same thing in C...
 >
 > It is (and Java and C# and pretty much every other C style language
 > though the nicer implicit conversion rules means it gets caught more
 > easily). It is a big source of programmer mistakes. It comes up
 > frequently in PVS Studio's open source analysis write ups.

Just a random Google find for some entertainment. :)

 
http://twistedoakstudios.com/blog/Post5273_how-to-read-nested-ternary-operators

   string result = i % 2 == 0 ? "a" : i % 3 == 0 ? "b" : i % 5 == 0 ? 
"c" : i % 7 == 0 ? "d" : "e";

Ali



More information about the Digitalmars-d-learn mailing list