Wireshark-dev: Re: [Wireshark-dev] Replace ntohl() with g_ntohl() -> automated check?

From: Thomas Anders <thomas.anders@xxxxxxxxxxxxx>
Date: Thu, 09 Nov 2006 14:50:29 +0100
Joerg Mayer wrote:
> On Tue, Nov 07, 2006 at 12:57:59PM +0000, LEGO wrote:
>> what about #defining them so they trigger an error?
> 
> #define ntohl error() won't work, a g_ntohl would match as well. 

I'm not sure that's true. Have you actually tried?

FWIW, Samba3 is doing something similar for C++ reserved words:
(http://viewcvs.samba.org/cgi-bin/viewcvs.cgi/branches/SAMBA_3_0_RELEASE/source/include/includes.h?rev=19018&view=markup)

- --- snip ---
/* only do the C++ reserved word check when we compile
   to include --with-developer since too many systems
   still have comflicts with their header files (e.g. IRIX 6.4) */

#if !defined(__cplusplus) && defined(DEVELOPER)
#define class #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
#define private #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
#define public #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
#define protected #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
#define template #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
#define this #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
#define new #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
#define delete #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
#define friend #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
#endif
- --- snap ---


+Thomas

-- 
Thomas Anders (thomas.anders at blue-cable.de)