Emma Wermstrom wrote:  /* EDITED */
> 
> >From the following code I get no errors or warnings from gcc:
> 
> typedef struct _Cmd_T {
>    int   Type;
>    int   FieldInfo;
>    union {
>       int                                  Constant;
>       /*@NULL@*/ void * const               NoData;
>    } AdditionalInfo;
> } Cmd_T;
> 
> /*@unused@*/ static const Cmd_T  Fields_C[2] =
> {            THIS IS AN ARRAY
>    {           THIS IS ITEM #0 OF THE ARRAY
>       4,   THIS IS AN INT        ******
>       5,   THIS IS AN INT       ******
>       9    THIS IS NOT A UNION   ******
>    },
>    {           THIS IS ITEM #1 OF THE ARRAY
>       6,
>       7,
        {        THIS IS A UNION
>          9        WITH AN INITIAL FIELD 9, AN INT
        }
>    }
> };
> 
> However, Splint has serious problems with it. I don't understand what you
> mean by correcting the initializing of the union. I've taken away the type
> definitions which I've used in my code in order for you to test the
> sequence. I still get the following warning message from splint:

Please do not top-post, and please confine your replies to the
newslist, barring reasons for privacy etc.  That way you may get
responses from a wide range, and bad advice can be corrected by
peer review.

Bear in mind that I have no special knowledge of splint.  See the
CAPITALIZED comments added above.  Compare then to the splint
warnings.  Questions would probably be better directed to
comp.lang.c, since they are about the language itself, and there
are many better qualified than I.

BTW to get the best out of gcc use -W -Wall -ansi -pedantic -O2. 
It needs the -O2 to find unused variables.

-- 
Chuck F ([EMAIL PROTECTED]) ([EMAIL PROTECTED])
   Available for consulting/temporary embedded and systems.
   <http://cbfalconer.home.att.net>  USE worldnet address!



Reply via email to