V
vcinquini
I've always learned about typedef as a statement that creates an alias
for a type. For example:
typedef long DWORD;
but I'm confused about the following typedef. Which is the type and
which is the alias?
class MyClass
{
public:
....
(some var declarations - doesn't matter here)...
....
typedef UINT(__stdcall *tpf_ServThread)(void*);
....
void ServerWaitConnections(tpf_ServThread pfThread);
.....
}
in the .cpp
void Sockets::ServerWaitConnections(tpf_ServThread pfThread)
{
struct sockaddr_in sadrRemote;
int nEndLen = sizeof(sadrRemote);
while ( m_Socket != INVALID_SOCKET )
{
SOCKET SockRemote = accept( m_Socket,
(struct sockaddr*) &sadrRemote,
&nEndLen );
if ( SockRemoto == INVALID_SOCKET )
break;
UINT nThID;
_beginthreadex( NULL,
0,
pfThread,
(void*)SockRemote,
0,
&nThID );
}
CloseSocket(m_Socket);
}
for a type. For example:
typedef long DWORD;
but I'm confused about the following typedef. Which is the type and
which is the alias?
class MyClass
{
public:
....
(some var declarations - doesn't matter here)...
....
typedef UINT(__stdcall *tpf_ServThread)(void*);
....
void ServerWaitConnections(tpf_ServThread pfThread);
.....
}
in the .cpp
void Sockets::ServerWaitConnections(tpf_ServThread pfThread)
{
struct sockaddr_in sadrRemote;
int nEndLen = sizeof(sadrRemote);
while ( m_Socket != INVALID_SOCKET )
{
SOCKET SockRemote = accept( m_Socket,
(struct sockaddr*) &sadrRemote,
&nEndLen );
if ( SockRemoto == INVALID_SOCKET )
break;
UINT nThID;
_beginthreadex( NULL,
0,
pfThread,
(void*)SockRemote,
0,
&nThID );
}
CloseSocket(m_Socket);
}