bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getline: protect prototype better


From: Ben Pfaff
Subject: Re: getline: protect prototype better
Date: Tue, 23 Aug 2005 08:28:14 -0700
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Simon Josefsson <address@hidden> writes:

> How about this?  If for some reason HAVE_DECL_GETLINE is not defined
> at all, the header file fail to parse.  This uses the idiom that is
> suggested by the autoconf manual.
>
> 2005-08-23  Simon Josefsson  <address@hidden>
>
>       * getline.h (getline): Protect prototype better.
>
> --- getline.h 17 Jul 2005 11:39:14 +0200      1.16
> +++ getline.h 23 Aug 2005 13:28:13 +0200      
> @@ -23,6 +23,6 @@
>  # include <stdio.h>
>  # include <sys/types.h>
>  
> -#if !HAVE_DECL_GETLINE
> +#if defined(HAVE_DECL_GETLINE) && !HAVE_DECL_GETLINE

A symbol that is not defined expands in the preprocessor to 0, so
the former should parse properly.  If it does not, then the
latter will not parse properly either.

The latter can be preferred because of its different meaning, not
because it should parse properly when the former does not.
Furthermore, in gnulib we know that the test will be performed,
so I don't see a reason to prefer the latter.
-- 
Ben Pfaff 
email: address@hidden
web: http://benpfaff.org





reply via email to

[Prev in Thread] Current Thread [Next in Thread]