bug-gnulib
[Top][All Lists]
Advanced

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

Re: gettext.h patch for portability to sunCC, pgCC, RHEL AS 4 g++


From: Bruno Haible
Subject: Re: gettext.h patch for portability to sunCC, pgCC, RHEL AS 4 g++
Date: Wed, 25 Oct 2006 21:03:34 +0200
User-agent: KMail/1.9.1

Paul Eggert wrote:
> Like Ben Pfaff, I don't understand the assertion that ISO
> C++ supports variable-length arrays.

Indeed, ISO C++ does not support variable-length arrays. Sorry for the
wrong statement.

> I just now checked the 2005-10-19 working draft
> <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1905.pdf>,

Thanks for the URL!

> And there's another problem, independent of C++.  A portable
> C program cannot use "defined" within a #define; the C
> standard requires "defined" to work only when it is used
> directly within #if (i.e., not as the result of a macro
> expansion).

You mean 6.10.1.(3)? I haven't seen it as a practical problem so far,
but here anyway I can avoid the problem by writing

  #define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \
    (__GNUC__ >= 3 || __GNUG__ >= 2)

> Instead, look at __STDC_VERSION__, since ISO C99 does require them.

__STDC__ and __STDC_VERSION__ are hardly usable in practice. We saw
compilers which defined __STDC__ and had either a traditional preprocessor
or no function prototypes (Coherent cc), and a compiler which has
__STDC_VERSION__ >= 199901L but doesn't support macros with variadic
arguments (OpenVMS 7.3 cc). Compiler vendors tend to implement the
features of a standard not all at once, and they define the macro
corresponding to that standard before they are done with all of the
features (or while some of the features are still buggy). I too have
been pushed into adding :ANSI-CL into clisp's *features* list early, for
marketing reasons. Therefore I don't think such tests will ever be reliable.

Bruno




reply via email to

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