Currently, I'm trying to check if the bind() statement fails in my code. From what I know, the way to go about this would be to check this condition:
if (bind(sock, (struct sockaddr *)&sock_addr, sizeof(sock_addr)) < 0)
{
G4cerr << "bind failed: " << strerror(errno) << " " << __FILE__ << ":" << __LINE__ << G4endl;
return(-1);
}
But I get the following error when I do this:
error: invalid operands to binary expression ('__bind<int &, sockaddr *, unsigned long>' and 'int')
I can see that '<' is a binary operation, which cannot compare two different data type but can't understand the reason for bind() not returning an integer value.
What am I missing here?
PS. This is a part of a GEANT4 application that someone in my lab wrote.