Re: [Wireshark-dev] enum or #define?

2010-02-15 Thread Guy Harris

On Feb 14, 2010, at 10:49 PM, Jaap Keuter wrote:

 That would probably be #1.
 This option makes verification against a protocol spec / RFC easiest,

...and

1) means some debuggers will, for values of the enum type in question, 
be able to print the value symbolically rather than numerically and

2) means that some compilers will warn, if you switch on the enum type 
in question, if you don't have a case for each of the known values of the enum.

(At least one of the debuggers, and one of the compilers, in question, have 
names beginning with the letter g, if you're curious. :-))
___
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


Re: [Wireshark-dev] enum or #define?

2010-02-15 Thread Mike Morrin
 or perhaps, option 3:
 enum {
 SSL_HND_HELLO_REQUEST=0,
 SSL_HND_CLIENT_HELLO=1,
 };
 ...

Maybe the best of both worlds?





This message contains confidential information and may be privileged. If you 
are not the intended recipient, please notify the sender and delete the message 
immediately.

ip.access Ltd, registration number 3400157, Building 2020, 
Cambourne Business Park, Cambourne, Cambridge CB23 6DW, United Kingdom
___
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


[Wireshark-dev] enum or #define?

2010-02-14 Thread Kaul
Which one is better?
option 1:
#define SSL_HND_HELLO_REQUEST  0
#define SSL_HND_CLIENT_HELLO   1
...

or perhaps, option 2:
enum {
SSL_HND_HELLO_REQUEST,
SSL_HND_CLIENT_HELLO,
 };
...

and then (in both cases):

const value_string ssl_31_handshake_type[] = {
{ SSL_HND_HELLO_REQUEST, Hello Request },
{ SSL_HND_CLIENT_HELLO,  Client Hello },


?

TIA,
Y.
___
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

Re: [Wireshark-dev] enum or #define?

2010-02-14 Thread Jaap Keuter
Hi,

That would probably be #1.
This option makes verification against a protocol spec / RFC easiest,  
also such values don't have to be sequential.

Thanks,
Jaap

Send from my iPhone

On 14 feb 2010, at 22:21, Kaul myk...@gmail.com wrote:

 Which one is better?
 option 1:
 #define SSL_HND_HELLO_REQUEST  0
 #define SSL_HND_CLIENT_HELLO   1
 ...

 or perhaps, option 2:
 enum {
 SSL_HND_HELLO_REQUEST,
 SSL_HND_CLIENT_HELLO,
 };
 ...

 and then (in both cases):

 const value_string ssl_31_handshake_type[] = {
 { SSL_HND_HELLO_REQUEST, Hello Request },
 { SSL_HND_CLIENT_HELLO,  Client Hello },


 ?

 TIA,
 Y.

 ___
 

 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
___
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