This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
bug or feature
- From: Yuriy Rubin <YRubin at TelicManagement dot com>
- To: "'gcc-bugs at gcc dot gnu dot org'" <gcc-bugs at gcc dot gnu dot org>
- Date: Wed, 23 Jan 2002 17:37:56 -0500
- Subject: bug or feature
#ifndef _COMM_H_
#define _COMM_H_
/*
#include <errno.h>
#include <sys/socket.h>
#include <unistd.h>
#include <netdb.h>
#include <string.h>
*/
struct sockaddr_in;
//////////////////////////////////////////////////////////////////////////
// class CBaseConn //
//////////////////////////////////////////////////////////////////////////
class CBaseConn
{
public:
CBaseConn();
virtual ~CBaseConn();
bool connect(const char* lpszHost,
int nPort);
bool connect();
protected:
bool m_bReady;
sockaddr_in* m_pServer;
};
#endif
Implementatio - comm.cpp:
#include "../inc/comm.h"
#include <errno.h>
#include <sys/socket.h>
#include <unistd.h>
#include <netdb.h>
#include <string.h>
//////////////////////////////////////////////////////////////////
// class CBaseConn //
//////////////////////////////////////////////////////////////////
CBaseConn :: CBaseConn()
{
};
CBaseConn :: ~CBaseConn()
{
delete m_pServer; m_pServer = NULL;
};
bool CBaseConn :: connect(const char* lpszHost, int nPort)
{
return connect();
};
bool CBaseConn :: connect()
{
int nRes = 0;
if(nRes < 0)
m_bReady = false;
else
m_bReady = true;
return m_bReady;
compile output:
g++ -Iinc -g -c src/comm.cpp
src/comm.cpp:24: no `bool CBaseConn::__xnet_connect(const char*, int)'
member
function declared in class `CBaseConn'
/usr/include/sys/socket.h: In member function `bool
CBaseConn::__xnet_connect(const char*, int)':
/usr/include/sys/socket.h:442: too few arguments to function `int
__xnet_connect(int, const sockaddr*, unsigned int)'
src/comm.cpp:25: at this point in file
src/comm.cpp: At global scope:
src/comm.cpp:29: prototype for `bool CBaseConn::__xnet_connect()' does not
match any in class `CBaseConn'
src/comm.cpp:24: candidate is: bool CBaseConn::__xnet_connect(const char*,
int)
Problem goes away if I uncomment include of systeme files in header file.
Is this a bug or feture of redefining all connect as __xnet_connect in
/sys/socket.h ?
Thank you
Regards
Yuriy Rubin
Telic Management LLC
(203) 861-8492
yrubin@paloma.com