[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/4] Avoid a stupid 'const object should have initializer' wa
From: |
Bruno Haible |
Subject: |
Re: [PATCH 3/4] Avoid a stupid 'const object should have initializer' warning |
Date: |
Wed, 28 Apr 2010 00:00:35 +0200 |
User-agent: |
KMail/1.9.9 |
Andreas Gruenbacher wrote:
> diff --git a/lib/getdate.y b/lib/getdate.y
> index 445865b..dcfe3cc 100644
> --- a/lib/getdate.y
> +++ b/lib/getdate.y
> @@ -152,7 +152,7 @@ typedef struct
> #if HAVE_COMPOUND_LITERALS
> # define RELATIVE_TIME_0 ((relative_time) { 0, 0, 0, 0, 0, 0, 0 })
> #else
> -static relative_time const RELATIVE_TIME_0;
> +static relative_time const RELATIVE_TIME_0 = { 0, 0, 0, 0, 0, 0, 0 };
> #endif
>
> /* Information passed to and from the parser. */
This patch makes the code less efficient: An allocation of n bytes in the
'data' segment causes n bytes to be read from disk. An allocation of
n bytes in the 'bss' segment does not.
> * lib/getdate.y (RELATIVE_TIME_0): Avoid a stupid 'const object should
> have initializer' warning.
Yes, the warning is stupid, except if you intend to compile the code with
a C++ compiler. But gnulib code is generally not prepared to be compiled
by a C++ compiler. Therefore I would suggest you turn off this type of
warning.
Bruno