www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - void initialization of non-arrays

reply =?UTF-8?B?VGhvbWFzIEvDvGhuZQ==?= writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The following code is illegal currently but does compile.

SomeType x = void;

It seems logical to me to legalize and document it.

http://dstress.kuehne.cn/nocompile/v/void_03_A.d
...
http://dstress.kuehne.cn/nocompile/v/void_03_Z.d


Thomas


-----BEGIN PGP SIGNATURE-----

iD8DBQFDA60M3w+/yD4P9tIRAqISAJ9j/kFWoz3tvYzoSNYxfdfDK++45QCglZv4
3v8225DDViE/3DvCwlGwy4w=
=Nnlh
-----END PGP SIGNATURE-----
Aug 17 2005
next sibling parent reply xs0 <xs0 xs0.com> writes:
Thomas Kühne wrote:
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
 The following code is illegal currently but does compile.
 
 SomeType x = void;
 
 It seems logical to me to legalize and document it.
 
 http://dstress.kuehne.cn/nocompile/v/void_03_A.d
 ....
 http://dstress.kuehne.cn/nocompile/v/void_03_Z.d
 
 
 Thomas
 
 
 -----BEGIN PGP SIGNATURE-----
 
 iD8DBQFDA60M3w+/yD4P9tIRAqISAJ9j/kFWoz3tvYzoSNYxfdfDK++45QCglZv4
 3v8225DDViE/3DvCwlGwy4w=
 =Nnlh
 -----END PGP SIGNATURE-----
Hmm, doesn't "=void" simply skip nulling/initializing the value? http://www.digitalmars.com/d/changelog.html#new0126 xs0
Aug 17 2005
parent =?ISO-8859-1?Q?Thomas_K=FChne?= <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

xs0 schrieb:

 Thomas Kühne wrote:
 
 The following code is illegal currently but does compile.
 
 SomeType x = void;
 
 It seems logical to me to legalize and document it.
 
 http://dstress.kuehne.cn/nocompile/v/void_03_A.d
 ....
 http://dstress.kuehne.cn/nocompile/v/void_03_Z.d
Hmm, doesn't "=void" simply skip nulling/initializing the value? http://www.digitalmars.com/d/changelog.html#new0126
This is only documented for arrays. http://www.digitalmars.com/d/memory.html#uninitializedarrays Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFDELPR3w+/yD4P9tIRAtKhAKCWq2u5TfGwxpyVo35GPcK23y4MBQCgo64C Tu42+N0/oI1VU3TweNkLDhw= =YoVP -----END PGP SIGNATURE-----
Aug 27 2005
prev sibling parent reply "Walter" <newshound digitalmars.com> writes:
"Thomas Kühne" <thomas-dloop kuehne.THISISSPAM.cn> wrote in message
news:de0ab6$fo5$1 digitaldaemon.com...
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1

 The following code is illegal currently but does compile.

 SomeType x = void;

 It seems logical to me to legalize and document it.

 http://dstress.kuehne.cn/nocompile/v/void_03_A.d
 ...
 http://dstress.kuehne.cn/nocompile/v/void_03_Z.d
It is legal and means the initialization is skipped. Perhaps it's poorly documented.
Aug 28 2005
parent =?UTF-8?B?VGhvbWFzIEvDvGhuZQ==?= <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Walter schrieb:

 "Thomas Kühne" <thomas-dloop kuehne.THISISSPAM.cn> wrote in message
 news:de0ab6$fo5$1 digitaldaemon.com...
 
The following code is illegal currently but does compile.

SomeType x = void;

It seems logical to me to legalize and document it.

http://dstress.kuehne.cn/nocompile/v/void_03_A.d
...
http://dstress.kuehne.cn/nocompile/v/void_03_Z.d
It is legal and means the initialization is skipped. Perhaps it's poorly documented.
The only section documenting the VoidInitializer is "Allocating Uninitialized Arrays On The Stack" and talks only about arrays, and not about primitive/class/struct/union/enum. Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFDEqJg3w+/yD4P9tIRAttaAJ0YYsjJrDQOG7rlyh7epygPC7nesgCglq8X FwNUSpwgTOhtcONslAx6nDo= =Vbgx -----END PGP SIGNATURE-----
Aug 28 2005