This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Is strongly-typed programming conceivable for C code using gcc ?
- From: "Dima Sorkin" <dima dot sorkin at gmail dot com>
- To: "Alexandre Beaugy" <beaugy dot ext at tlse dot sofreavia dot fr>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Wed, 19 Sep 2007 16:48:03 +0200
- Subject: Re: Is strongly-typed programming conceivable for C code using gcc ?
- References: <016101c7fac6$cec89930$4121820a@tlse.sofreavia.fr>
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 */
>