Why #if 0 ... #endif
-
What would be a purpose of enclosing a block of code with #if 0 ... #endif
//#if 0
qDebug() << "Discovered service on"
<< serviceInfo.device().name() << serviceInfo.device().address().toString();
qDebug() << "\tService name:" << serviceInfo.serviceName();
qDebug() << "\tDescription:"
<< serviceInfo.attribute(QBluetoothServiceInfo::ServiceDescription).toString();
qDebug() << "\tProvider:"
<< serviceInfo.attribute(QBluetoothServiceInfo::ServiceProvider).toString();
qDebug() << "\tL2CAP protocol service multiplexer:"
<< serviceInfo.protocolServiceMultiplexer();
qDebug() << "\tRFCOMM server channel:" << serviceInfo.serverChannel();
//#endif -
What would be a purpose of enclosing a block of code with #if 0 ... #endif
//#if 0
qDebug() << "Discovered service on"
<< serviceInfo.device().name() << serviceInfo.device().address().toString();
qDebug() << "\tService name:" << serviceInfo.serviceName();
qDebug() << "\tDescription:"
<< serviceInfo.attribute(QBluetoothServiceInfo::ServiceDescription).toString();
qDebug() << "\tProvider:"
<< serviceInfo.attribute(QBluetoothServiceInfo::ServiceProvider).toString();
qDebug() << "\tL2CAP protocol service multiplexer:"
<< serviceInfo.protocolServiceMultiplexer();
qDebug() << "\tRFCOMM server channel:" << serviceInfo.serverChannel();
//#endifIt's a way of commenting out a block of code. In your case, seems like a way to eliminate some debug messages.
Mircea
-
It's a way of commenting out a block of code. In your case, seems like a way to eliminate some debug messages.
Mircea
-
BUT does #if 0 evaluates to "true " ? I have been using #ifdef BYPASS #endif where BYPASS is not defined to skip the enclosed block
Quote:
BUT does #if 0 evaluates to "true " ?
0 evaluates to 'false' see, for instance, the bottom line of this page: If (The C Preprocessor)[^]
Quote:
I have been using #ifdef BYPASS #endif where BYPASS is not defined to skip the enclosed block
The compiler skips the code if
BYPASS
is not defined (that is, the 'condition' is 'false')."In testa che avete, Signor di Ceprano?" -- Rigoletto