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".
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@wireshark.org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-requ...@wireshark.org?subject=unsubscribe

Reply via email to