www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - integral constant must be scalar type, not void

reply Stewart Gordon <smjg_1998 yahoo.com> writes:
Using DMD 0.129, Windows 98SE.

----------
void[10] data;
----------
d:\data\stewart\d\tests\bugs>dmd integral_void.d
integral constant must be scalar type, not void
----------

Both missing filename and line number, and completely meaningless in the 
context.  The code looks valid to me, judging by the fact that .length 
and slicing work on dynamic void[].

(DStress seems to be down at the mo - unless it's my Internet connection 
playing silly donkeys....)

Stewart.

-- 
My e-mail is valid but not my primary mailbox.  Please keep replies on 
on the 'group where everyone may benefit.
Aug 16 2005
parent reply =?ISO-8859-1?Q?Thomas_K=FChne?= <thomas-dloop kuehne.THISISSPAM.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stewart Gordon schrieb:
 (DStress seems to be down at the mo - unless it's my Internet connection
 playing silly donkeys....)

Seems to be your connection. Please try the webinterface of the backup: http://svn.berlios.de/viewcvs/*checkout*/dstress/www/dstress.html Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFDAke03w+/yD4P9tIRAumrAKDLBDcmkyfYD/OG4vj711yq10sm5QCfUO6V GZrzmOKU1qwTqKTshaF3FIs= =8iZM -----END PGP SIGNATURE-----
Aug 16 2005
parent reply Stewart Gordon <smjg_1998 yahoo.com> writes:
Thomas Kühne wrote:
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
 Stewart Gordon schrieb:
 
 (DStress seems to be down at the mo - unless it's my Internet connection
 playing silly donkeys....)

Seems to be your connection. Please try the webinterface of the backup: http://svn.berlios.de/viewcvs/*checkout*/dstress/www/dstress.html

Thank you. It seems to work at the moment.... So, is the testcase I just gave you in there? I can't seem to find it and you haven't posted a link.... But I did notice a typo: module dtsress.run.v.void_01; ^^ Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on on the 'group where everyone may benefit.
Aug 17 2005
parent reply =?UTF-8?B?VGhvbWFzIEvDvGhuZQ==?= writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stewart Gordon schrieb:
 So, is the testcase I just gave you in there?  I can't seem to find it
 and you haven't posted a link....

 ----------
 void[10] data;
 ----------
 d:\data\stewart\d\tests\bugs>dmd integral_void.d
 integral constant must be scalar type, not void
 ----------

 Both missing filename and line number, and completely meaningless in
 the context.  The code looks valid to me, judging by the fact that
 .length and slicing work on dynamic void[].

The following code is illegal: void[10] a; void b; Reason: void.init is undefined You might use: void[10] c = void; Added to DStress as http://dstress.kuehne.cn/nocompile/v/void_02_A.d http://dstress.kuehne.cn/nocompile/v/void_02_B.d http://dstress.kuehne.cn/run/v/void_02_C.d
 But I did notice a typo:
 
 module dtsress.run.v.void_01;
         ^^

Thanks, fixed Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFDA6XY3w+/yD4P9tIRAj+MAJ9ezE0PfjUwRkh1jw7jrUsYoUX9mwCfTAqJ CS6UKzHFKqUtmy9jwLpNHgQ= =KwvH -----END PGP SIGNATURE-----
Aug 17 2005
parent reply Stewart Gordon <smjg_1998 yahoo.com> writes:
Thomas Kühne wrote:
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
 Stewart Gordon schrieb:
 
 So, is the testcase I just gave you in there? I can't seem to find 
 it and you haven't posted a link....

 ----------
 void[10] data;
 ----------
 d:\data\stewart\d\tests\bugs>dmd integral_void.d
 integral constant must be scalar type, not void
 ----------
 
 Both missing filename and line number, and completely meaningless 
 in the context. The code looks valid to me, judging by the fact 
 that .length and slicing work on dynamic void[].

The following code is illegal: void[10] a; void b; Reason: void.init is undefined

So why is the length of a void[] writable? ---------- import std.stdio; void[] data; void main() { data.length = 10; foreach (ubyte b; cast(ubyte[]) data) { writefln(b); } } ---------- Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on on the 'group where everyone may benefit.
Aug 20 2005
parent =?ISO-8859-1?Q?Thomas_K=FChne?= <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stewart Gordon schrieb:

 Thomas Kühne wrote:
 
 Stewart Gordon schrieb:

 So, is the testcase I just gave you in there? I can't seem to find it
 and you haven't posted a link....

 ----------
 void[10] data;
 ----------
 d:\data\stewart\d\tests\bugs>dmd integral_void.d
 integral constant must be scalar type, not void
 ----------

 Both missing filename and line number, and completely meaningless in
 the context. The code looks valid to me, judging by the fact that
 .length and slicing work on dynamic void[].

The following code is illegal: void[10] a; void b; Reason: void.init is undefined

<snip> So why is the length of a void[] writable? ---------- import std.stdio; void[] data; void main() { data.length = 10; foreach (ubyte b; cast(ubyte[]) data) { writefln(b); } } ----------

http://www.digitalmars.com/d/arrays.html # If the new array length is shorter, only enough are copied to fill the # new array. If the new array length is longer, the remainder is filled # out with the default initializer. Decreasing the void[]'s length is legal, but increasing isn't. Currently dynamic void's are useless as they can only contain zero elements. solution A: define void.init solution B: a combination of change length and VoidInitializer for the new array elements e.g. void[] data; data.length(10, void); http://dstress.kuehne.cn/nocompile/a/array_initialization_19.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFDELEJ3w+/yD4P9tIRAv30AJ9SXFYpfsDqdtcClYDXs2K/MMMmRgCgr2Wy uVycD3JPBRf8LjH8DfJd9tQ= =g1Hf -----END PGP SIGNATURE-----
Aug 27 2005