Re: [RFC] USE_ and HAVE_ definitions

From: Tsantilas Christos <chtsanti_at_users.sourceforge.net>
Date: Sun, 29 Mar 2009 11:36:02 +0300

Hi Amos,
  Some comments about "#if X" and "#ifdef X".
The gcc compiler when X is not defined, always assume that it is 0 when
appeared in an "#if". So it is safe to use the #if instead of #ifdef.
But maybe there is problem with other compilers (If I am not wrong
visual c++ is an example).

Personaly I am confused when I have to use #if and #ifdef in squid.
 From what I can see squid prefers to use #if in most cases, but I
believe this is not correct. The #ifdef should used when a preprocessor
variable is defined or not defined and #if when it is 0 or not 0.

Regards,
      Christos

Amos Jeffries wrote:
>
> At present we have a little bit of a mess with the configure.in defined
> macros.
>
> 1) defined or undefined.
> For coding: #ifdef or #ifndef
> Combined form: #if defined(X) && defined(Y) ...
>
> 2) always defined.
> For coding: #if X
> Combined form: #if X && Y ...
>
> I'm thinking the HAVE_ should be method (1) and the USE_ should be
> method (2).
>
> Do we already have a formal policy somewhere I've missed?
>
> If we don't, Opinions on what to adopt?
>
>
> Amos
Received on Sun Mar 29 2009 - 09:36:45 MDT

This archive was generated by hypermail 2.2.0 : Mon Mar 30 2009 - 12:00:04 MDT