I use gcc version compiler in Ubuntu 18.04.3 LTS. ROS libraries are used. My code goes like this very simple:
typedef unsigned char boolean;
#define TRUE (boolean)(1)
#define FALSE (boolean)(0)
With the above compiled, I am getting compiler errors:
error: missing binary operator before token "("
#define TRUE (boolean)(1)
^
Usage of the above #define
is in OS Library file I guess.
../../../M3N_BSW/bsw_pc/virtual/ros/librosc/XmlRpc/include/ros_lm_xml_value.h:80:6: note: in expansion of macro ‘TRUE’
---------------------------------------------------------------------
#if (TRUE == ROS_LM_XML_VALUE_DOUBLE_ENABLE) /* [05] */
^~~~
However when I defined as below, no errors.
#define SOMETHING ( ( uchar8 ) 1 )
Similarly, the keyword boolean
is used in other places to declare variables and those are working fine. Refer below code..
And
Usage place goes like this:
#define ROS_LM_XML_VALUE_DOUBLE_ENABLE (FALSE)
someFunc()
{
boolean someVar=FALSE; //How come this is recognized correctly ?
#if (TRUE == ROS_LM_XML_VALUE_DOUBLE_ENABLE)
{
//Do something
}
}
Usage of keyword boolean
with #define
goes wrong somewhere.
Please guide me.
The same code is used in INTEGRITY
OS.
No compiler errors.