www.digitalmars.com         C & C++   DMDScript  

D - Help with Pavel's socket.d ?


I'm trying to compile Pavel's socket.d
(Win2K, DMD 0.41)

I'm getting this error : 
socket.d: class IP 2duplicate union initialization for address

It seems to have something to do with the anonymous union.
Is ubyte[4] fundamentally different from uint ?

I don't have a C/C++ background, so I'm probably missing 
something obvious.

Here's a reduced version that displays the same behaviour :

class IP
		ubyte[4] b;
		uint address;

	this(ubyte b1, ubyte b2, ubyte b3, ubyte b4)
		b[0] = b1; b[1] = b2; b[2] = b3; b[3] = b4;
		printf("%d.%d.%d.%d", b[0], b[1], b[2], b[3]);
		printf("%d", address);

int main()
	IP ip;
	ip = new IP(23, 8, 42, 15);
	return 0;

Can anyone lend me a clue ?

Regards, Myles.
Sep 12 2002