[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Compile Error in c99
From: |
Nicholas Marriott |
Subject: |
Re: Compile Error in c99 |
Date: |
Thu, 20 Aug 2020 08:54:52 +0100 |
Hi
Interesting. The standard says objects with static storage duration that
are not explicitly initialized are zero and I don't see anything that
makes this any different for block scope or for constants, what makes
you think the compiler is right?
On Wed, Aug 19, 2020 at 07:23:29PM -0400, Randall S. Becker wrote:
> The c99 compiler used on NonStop caught this one. I think it's legit:
>
>
>
> static const TTY null_TTY; /* all zeros iff uninitialized */
>
> ^
>
>
> "/home/jenkins/.jenkins/workspace/Ncurses_Pipeline/ncurses/../ncurses/./base/lib_set_term.c",
> line 309: warning(338):
>
> const variable "null_TTY" requires an initializer
>
>
>
>
>
> A const scalar should be initialized. Do not depend on the compiler to
> generate initialization code. This may come from whatever is on the stack
> instead of memory, which is assumed for globals, but not for stack
> variables.
>
>
>
> Regards,
>
> Randall
>
>
>
> --
>
> Randall S. Becker
>
> ITUGLIB Process Designer, Repository Manager, Occasional Porting Dude
>
> +1.416.984.9826
>
> NonStop developer since approximately 211288444200000000
>
> UNIX developer since approximately 421664400
>
> -- In my real life, I talk too much.
>
>