The empty statement ";" - when is it useful?

Arthur Lloyd via at google.com
Wed Jul 29 07:29:51 PDT 2009


Andrei Alexandrescu Wrote:

> I think he just means that the comma operator is not a strategic 
> advantage for automated code generation.

If the comma operator does not offer a strategic advantage, will it be deprecated in favor of something that python and ruby do. I've many times fallen into a trap when initializing multidim arrays, like:

#  int[][] a;
#  a.length = 3,4;

Also

#  struct coordinates { int x; int y; }
#  coordinates getThem() { coordinates c; c.x = 4; c.y = 5; return c; }
#  auto a = getThem();

seems very verbose when in a scripting language I can do:

#  def getThem() { (4, 5) }
#  a = getThem

Does this work, if the comma builds a tuple instead of a sequence?



More information about the Digitalmars-d mailing list