[wsf-c-dev] [C++] Question on data types

Damitha Kumarage damitha at wso2.com
Thu Oct 18 05:14:21 PDT 2007


Hi Uthaiyashankar,
Please see my inline comment

>>
> On the other hand,
>
> if api function foo is
> void foo(axis2_bool_t status)
> {
>    if (status == AXIS2_TRUE)
>          do something;
> }
>
> and bar is
> void bar(bool status)
> {
>    return foo(status);
> }
>
> and the call is
> bar(true);
>
> then, foo might or might not work. C++ specification tells "true has 
> to be non zero value and false has to be zero value". However,  it 
> does not specify a specific integer value for true. Most of the 
> compilers are using true = 1, but it is not a must. I don't know 
> whether there are any compilers which are specifying other values for 
> true. So, for the safe side, bar has to be
> void bar(bool status)
> {
>    if (status)
>          return foo(AXIS2_TRUE);

if(status == AXIS2_SUCCESS), although visible in lot of places in code 
base is not according to our coding standards.  Correct approach is 
if(status). The reason that it exists in lot of places is that, the 
coding standard is finalized after some amout of coding in the base.




More information about the Wsf-c-dev mailing list