Give struct the status it deserves

Stewart Gordon smjg_1998 at yahoo.com
Tue Mar 28 02:57:31 PST 2006


Norbert Nemec wrote:
> I partly agree with you.
> 
> 1) A constructor for structs would definitely be necessary: Currently, a
> struct is always initialized to all-zero fields. The "static opCall" is
> nice syntactic sugar for changing the contents of the struct afterwards,
> but it does not allow a guaranteed initialization, since D does not
> force you to call opCall.
<snip>

Struct members can have default initialisers.  The only way in which it 
"does not allow a guaranteed initialization" is that it's possible to 
override default initialisers with a static initialiser.  But that's 
just like changing members one-by-one after it's been initialised.

Stewart.

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/M d- s:-@ C++@ a->--- UB@ P+ L E@ W++@ N+++ o K-@ w++@ O? M V? PS- 
PE- Y? PGP- t- 5? X? R b DI? D G e++>++++ h-- r-- !y
------END GEEK CODE BLOCK------

My e-mail is valid but not my primary mailbox.  Please keep replies on 
the 'group where everyone may benefit.



More information about the Digitalmars-d mailing list