This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Hi.
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.

Regards,
 Dima.

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 */
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]