Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] Is it just me? (build error in packet-q708.c)

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Wed, 19 May 2010 13:47:09 -0700
On May 19, 2010, at 1:21 PM, Gerasimos Dimitriadis wrote:

> I think that in this case there is no need for a conversion macro, since 
> we are not dealing with arrays but with pointers to value_string_ext.
> By the way, are the VALS/TFS/RVALS casts necessary for certain 
> compilers?  Because I thought that arrays automatically decay to pointers 
> when needed

Yes, that's what the ANSI/ISO C standard says.  

I'm not sure why those macros exist.  I have the impression that at least one purpose of the macro might be to do type checking.  The "structure to help you interpret the data in a more human-readable fashion" pointer is a void *, so there's no type checking; if you say VALS(something that's not a value_string array or pointer), the compiler will warn you.  "Make a const value_string[] look like a _value_string pointer" shouldn't be ncessary, as, in most contexts, a reference in C to an array of X is converted to a value of type "pointer to X", and "value_string" is a typedef for "struct _value_string".