Ethereal-dev: Re: [ethereal-dev] Problem with packet-stat.c

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <guy@xxxxxxxxxx>
Date: Thu, 18 Nov 1999 11:56:03 -0800 (PST)
> In packet-stat.c, insde proto_register_stat, around line 68-74:
> 
>         static hf_register_info hf[] = {
> #if 0
>                 { &hf_stat_path, {
>                         "Path", "stat.path", FT_STRING, BASE_DEC,
>                         NULL, 0, "Path" }},
> #endif
>         };
> 
> 
> What is going on here?

Some dissectors have "placeholder" arrays of "hf_register_info",
presumably to serve as a template when the code is changed to use
registered fields.  I assume that's the intent here.

> The IBM C compiler apparently doesn't allow you to compile
> an array initializer with 0 elements, ie. char foo[] = {}; is 
> a no-no.
> This causes compilation errors for me.

Zero-length arrays are a GCC extension; the ANSI C standard does not, as
far as I know, require compilers to support them.

I'd vote for doing

#if 0
        static hf_register_info hf[] = {
                { &hf_stat_path, {
                        "Path", "stat.path", FT_STRING, BASE_DEC,
                        NULL, 0, "Path" }},
        };
#endif

and surrounding the "proto_register_field_array()" call with "#if
0"/"#endif" as well.

I'll check in a change to that effect.