axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Damitha Kumarage <damith...@gmail.com>
Subject Re: Need of a new coding convention
Date Wed, 31 Oct 2007 00:54:29 GMT
senaka@wso2.com wrote:

>As you see, axis2_bool_t, has two values, AXIS2_TRUE and AXIS2_FALSE that
>corresponds to true and false respectively.
>Now when such a type is compared in an 'if' or a 'while' as in,
>if (..statement..) or while (..statement..) there are two mechanisms used.
>
>That is,
>lets assume myVar = AXIS2_TRUE;
>
>Now, we have used,
>1. if (myVar) { }
>2. if (AXIS2_TRUE == myVar) { }
>  
>
I think 1 is the correct one according to the axis2c coding standards.

>Therefore, it is kind of confusing at times.
>
>As, AXIS2_TRUE is being defined as 1, and AXIS2_FALSE is being defined as
>0, things would work alright (refer axutil_utils_defines.h).
>
>But, however, it is better to stick to option 2, as  axis2_bool_t is
>derived from int, and thus can have more than 2 values in theory 
>
Althouth axis2_bool_t is defined to be of type int it is intended to use
it as int
for example don't use
axis2_bool_t bool = 100;

Damitha

>(Ex:- if
>someone sets myVar = 3). If we opt to use option 1, it could potentially
>lead to an erroneous state recognized as true, which is apparently not
>what we expect.
>
>I believe this issue needs some attention.
>
>Senaka.
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
>For additional commands, e-mail: axis-c-dev-help@ws.apache.org
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org


Mime
View raw message