Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
August 17, 2005 void initialization of non-arrays | ||||
---|---|---|---|---|
| ||||
Attachments: | 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 |
August 17, 2005 Re: void initialization of non-arrays | ||||
---|---|---|---|---|
| ||||
Posted in reply to Thomas Kühne | 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 |
August 27, 2005 Re: void initialization of non-arrays | ||||
---|---|---|---|---|
| ||||
Posted in reply to xs0 Attachments: | 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 |
August 28, 2005 Re: void initialization of non-arrays | ||||
---|---|---|---|---|
| ||||
Posted in reply to Thomas Kühne | "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. |
August 29, 2005 Re: void initialization of non-arrays | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Attachments: | 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 |
Copyright © 1999-2021 by the D Language Foundation