Thread overview
integral constant must be scalar type, not void
Aug 16, 2005
Stewart Gordon
Aug 16, 2005
Thomas Kühne
Aug 17, 2005
Stewart Gordon
Aug 17, 2005
Thomas Kühne
Aug 20, 2005
Stewart Gordon
Aug 27, 2005
Thomas Kühne
August 16, 2005
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.
August 16, 2005
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
August 17, 2005
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.
August 17, 2005
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

August 20, 2005
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
<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);
    }
}
----------

Stewart.

-- 
My e-mail is valid but not my primary mailbox.  Please keep replies on on the 'group where everyone may benefit.
August 27, 2005
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