Is strongly-typed programming conceivable for C code using gcc ?

Dima Sorkin
Wed Sep 19 14:53:00 GMT 2007

CW_C_MsgUp_t and CW_C_MsgDown_t are not really different types,
they are just aliases to the same type.

Maybe wrapping them with a "struct" is good for you, something like

typedef struct {
   void* ptr;
} CW_C_MsgUp_t;

typedef struct {
   void* ptr;
} CW_C_MsgDown_t;

Now they are different.


On 9/19/07, Alexandre Beaugy  wrote:
>   typedef  void  CW_C_MsgUp_t;
>   typedef  void  CW_C_MsgDown_t;
>   int sendMsg(CW_C_MsgUp_t *up_msg);
>   int getMsg(CW_C_MsgDown_t *down_msg);
>     sendMsg(my_up_msg); /* OK */
>     getMsg(my_up_msg); /* KO: accepted by gcc (at compilation time),*/
>     getMsg(my_down_msg); /* OK: expected good use of the function */

More information about the Gcc-help mailing list