[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 10:44:14 +0200 |
User-agent: |
KMail/1.9.9 |
Simon Josefsson wrote:
> Isn't
>
> static relative_time const RELATIVE_TIME_0 = { };
>
> equivalent too? I find that is a nice idiom.
This syntax is not portable. Sun C, for example, does not like it:
$ cat foo.c
typedef struct
{
/* Relative year, month, day, hour, minutes, seconds, and nanoseconds. */
long int year;
long int month;
long int day;
long int hour;
long int minutes;
long int seconds;
long int ns;
} relative_time;
static relative_time const RELATIVE_TIME_0 = { };
$ cc -c foo.c
"foo.c", line 13: warning: syntax error: empty initializer
Bruno