diff options
author | Jaap Keuter <jaap.keuter@xs4all.nl> | 2007-07-13 06:28:44 +0000 |
---|---|---|
committer | Jaap Keuter <jaap.keuter@xs4all.nl> | 2007-07-13 06:28:44 +0000 |
commit | b989e08afd3412df954db6f1ba9a3a19f9762780 (patch) | |
tree | 1a7c429c7f6c90ae42c5a60da17cbf1ed8191942 /doc | |
parent | 25df9f213339d86b32b12ef7ce9b6f59d07435aa (diff) |
Added remark on anonymous unions.
svn path=/trunk/; revision=22294
Diffstat (limited to 'doc')
-rw-r--r-- | doc/README.developer | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/doc/README.developer b/doc/README.developer index d70855508f..0befb17a01 100644 --- a/doc/README.developer +++ b/doc/README.developer @@ -101,6 +101,15 @@ functions declared in header files; if it doesn't work, don't declare the function in a header file, even if this requires that you not make it inline on any platform. +Don't use anonymous unions; not all compilers support it. Example: +typedef struct foo { + guint32 foo; + union { + guint32 foo_l; + guint16 foo_s; + } u; /* have a name here */ +} foo_t; + Don't use "uchar", "u_char", "ushort", "u_short", "uint", "u_int", "ulong", "u_long" or "boolean"; they aren't defined on all platforms. If you want an 8-bit unsigned quantity, use "guint8"; if you want an @@ -467,7 +476,8 @@ Do *NOT* use "g_assert()" or "g_assert_not_reached()" in dissectors. that it's a problem with the dissector if found; if it cannot do anything else with a particular value from a packet's data, the dissector should put into the protocol tree an indication that the -value is invalid, and should return. +value is invalid, and should return. You can use the DISSECTOR_ASSERT +macro for that purpose. If you are allocating a chunk of memory to contain data from a packet, or to contain information derived from data in a packet, and the size of |