bug-ncurses
[Top][All Lists]
Advanced

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

Re: Compile Error in c99


From: Thomas Dickey
Subject: Re: Compile Error in c99
Date: Thu, 20 Aug 2020 04:04:28 -0400
User-agent: NeoMutt/20170113 (1.7.2)

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

longstanding practice says that static variables are guaranteed to be zeroed
(this compiler appears to ignore the "static").  I guess that's something
to verify vs the C and POSIX standards...

> 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.

static variables aren't on the stack...

-- 
Thomas E. Dickey <dickey@invisible-island.net>
https://invisible-island.net
ftp://ftp.invisible-island.net

Attachment: signature.asc
Description: PGP signature


reply via email to

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