TSocket ordered comparison of pointer with integer zero ('TSocket*' and 'long int')

Dear ROOT community,

I am attempting to compile a piece of code for DAQ and, while it works on another PC, it fails on this one. The only difference being that this one runs on Debian 12 while the other runs Debian 11 (and the specs are different as well, this second PC is generally newer). The make process fails on the second of those lines:

m_Socket = new TSocket(host.c_str, port);
if((m_Socket<=NULL) || (!m_Socket->Valid())){

with ** error: ordered comparison of pointer with interger zero (‘TSocket*’ and ‘long int’) **

Seeing as the compilation functioned perfectly on the other machine, which runs the same ROOT version I am not certain as to what would be wrong with this one.

Cheers

ROOT Version: 6.24/09
Platform: Debian 12
Compiler: g++/gcc


A better formulation:

if( (m_Socket == nullptr) || (!m_Socket->Valid()) ) {

(Since a pointer is always an unsigned value, the ‘<’ is meaningless anyway and the compiler is now warning that its use might indicates that the code may or may not be doing what is intended)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.