dmd 2.063 beta 5

Dicebot m.strashun at gmail.com
Thu May 23 07:42:25 PDT 2013


something I may have actually used in real code writing a 
low-level networking library:

struct Packet
{
	immutable etherType = 0x0800; // IPv4 by default;
	
	// ...
	
	this(bool IPv6)
	{
		if (!IPv6)
			return; // fine with default, same as Packet.init
		else
		{
			etherType = 0x86DD;
			// ...
		}
	}
}

void main()
{
	auto buffer = cast(ubyte[])(Packet(true));
}


More information about the Digitalmars-d-announce mailing list