You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by Anuradha Ratnaweera <an...@taprobane.org> on 2006/10/11 13:53:02 UTC

[Axis2] Superfluous typedefs

Hi all,

Can someone please explain the reason for redefining some standard types 
in util/include/axis2_utils_defines.h:

     typedef char axis2_char_t;
     typedef int axis2_bool_t;
     typedef int axis2_status_t;
     typedef int axis2_scope_t;
     typedef unsigned int axis2_ssize_t;
     typedef char axis2_byte_t;

IMHO, these definitions are confusing to people like me who look at Axis 
C code not so frequently.

However, I am fluent in POSIX, SUS, ISO/ANSI C, C99 etc, so it's easy 
for me to read the code and contribute if such superfluous typedefs are 
minimized.  I know int8_t is signed 8 bit in C99, but I have to refer to 
the definition of axis2_byte_t to figure out what it is.

This is what I feel about the above six typedefs.  Please check out the 
C99 section of the Wikipedia C article for more details needed to 
understand some of my comments (and other places about C99):

     http://en.wikipedia.org/wiki/C_%28programming_language%29

- typedef char axis2_char_t;

   Not needed.

- typedef int axis2_bool_t;

   C99 has a type "bool" via "stdbool.h".

- typedef int axis2_status_t;

   Just "int"? ... ;-)

- typedef int axis2_scope_t;

   No idea about this one... ;-)

- typedef unsigned int axis2_ssize_t;

   Why not just "size_t"?

- typedef char axis2_byte_t;

   Why not char?  If you want signed or signed 8 bit values,
   there are standards types (from C99) such as int8_t in inttypes.h.

I would like to volunteer to send incremental patches if the project is 
willing to "fix" such superfluous typedefs and other similar "extra 
luggage"... ;-)

         Anuradha
-- 
http://anuradha-ratnaweera.blogspot.com
http://www.linux.lk/~anuradha/


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


Re: [Axis2] Superfluous typedefs

Posted by Anuradha Ratnaweera <an...@taprobane.org>.
On 10/11/06, Anuradha Ratnaweera <an...@taprobane.org> wrote:
>
> Please check out the C99 section of the Wikipedia C
> article for more details needed to understand some
> of my comments (and other places about C99):
>
> http://en.wikipedia.org/wiki/C_%28programming_language%29

GCC supports C99 quite well:

http://gcc.gnu.org/c99status.html

        Anuradha
-- 
http://anuradha-ratnaweera.blogspot.com
http://www.linux.lk/~anuradha/

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


Re: [Axis2] Superfluous typedefs

Posted by Samisa Abeysinghe <sa...@gmail.com>.
Anuradha Ratnaweera wrote:
>
> Hi all,
>
> Can someone please explain the reason for redefining some standard 
> types in util/include/axis2_utils_defines.h:
>
>     typedef char axis2_char_t;
>     typedef int axis2_bool_t;
>     typedef int axis2_status_t;
>     typedef int axis2_scope_t;
>     typedef unsigned int axis2_ssize_t;
>     typedef char axis2_byte_t;
>
> IMHO, these definitions are confusing to people like me who look at 
> Axis C code not so frequently.
These types were defined initially with the idea of changing the type in 
the future. e.g., what if our char type becomes wide char, or utf8? 
However, I have to agree that we have not used this type all over the 
code with this initial thought in mind.
Some other types such as status, scope, ssize were defined looking at APR.
With time, we have taken these types for granted - it is good that you 
have raised this question at this time, we can have an open discussion 
on what types we really need and how to use them.

Thanks,
Samisa...

>
> However, I am fluent in POSIX, SUS, ISO/ANSI C, C99 etc, so it's easy 
> for me to read the code and contribute if such superfluous typedefs 
> are minimized.  I know int8_t is signed 8 bit in C99, but I have to 
> refer to the definition of axis2_byte_t to figure out what it is.
>
> This is what I feel about the above six typedefs.  Please check out 
> the C99 section of the Wikipedia C article for more details needed to 
> understand some of my comments (and other places about C99):
>
>     http://en.wikipedia.org/wiki/C_%28programming_language%29
>
> - typedef char axis2_char_t;
>
>   Not needed.
>
> - typedef int axis2_bool_t;
>
>   C99 has a type "bool" via "stdbool.h".
>
> - typedef int axis2_status_t;
>
>   Just "int"? ... ;-)
>
> - typedef int axis2_scope_t;
>
>   No idea about this one... ;-)
>
> - typedef unsigned int axis2_ssize_t;
>
>   Why not just "size_t"?
>
> - typedef char axis2_byte_t;
>
>   Why not char?  If you want signed or signed 8 bit values,
>   there are standards types (from C99) such as int8_t in inttypes.h.
>
> I would like to volunteer to send incremental patches if the project 
> is willing to "fix" such superfluous typedefs and other similar "extra 
> luggage"... ;-)
>
>         Anuradha


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