www.digitalmars.com         C & C++   DMDScript  

D - static initialization of structs and using ':'

reply Matt Gessner <mattg aiinet.com> writes:
Greetings...

C99 (and gnu for a while) implemented this using '='
not ':'.  I.e.

struct X { int a; int b; };

static X x = { a = 1, b = 2 };

I don't care for C99's use of the '.' before the
field name; D's syntax is much cleaner.

Regards,

Matt
Aug 16 2001
parent "Walter" <walter digitalmars.com> writes:
Matt Gessner wrote in message <3B7C1A1C.2010001 aiinet.com>...
Greetings...

C99 (and gnu for a while) implemented this using '='
not ':'.  I.e.

struct X { int a; int b; };

static X x = { a = 1, b = 2 };

I don't care for C99's use of the '.' before the
field name; D's syntax is much cleaner.

Regards,

Matt

I just liked the look of the : better.
Aug 18 2001