Why is a cast needed here?
Dave
Dave_member at pathlink.com
Sat Nov 25 10:14:00 PST 2006
import std.socket;
void main()
{
//Socket s = new Socket(AddressFamily.INET,SocketType.STREAM,ProtocolType.TCP);
Socket s = new Socket(cast(AddressFamily)AddressFamily.INET,SocketType.STREAM,ProtocolType.TCP);
}
Why is the 'cast(AddressFamily)' needed?
W/o the cast:
t.d(5): constructor std.socket.Socket.this () does not match parameter types
(int,SocketType,ProtocolType)
t.d(5): Error: cannot implicitly convert expression (2) of type int to AddressFamily
t.d(5): Error: cannot implicitly convert expression (6) of type ProtocolType to char[]
t.d(5): Error: cannot cast int to char[]
Thanks!
More information about the Digitalmars-d-learn
mailing list