public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* const issues
@ 2008-02-29  8:07 Jason Pepas
  2008-02-29  8:13 ` Dario Saccavino
  0 siblings, 1 reply; 3+ messages in thread
From: Jason Pepas @ 2008-02-29  8:07 UTC (permalink / raw)
  To: gcc-help

this compiles as expected:


#include <stdlib.h>

int main()
{
    const int a = 42;
    const int * const b = &a;
    const int * const c = b;

    return EXIT_SUCCESS;
}


but moving the variables outside of the function causes gcc to die
with "error: initializer element is not constant" on line 5 (the "c =
b" line):


#include <stdlib.h>

const int a = 42;
const int * const b = &a;
const int * const c = b;

int main()
{
    return EXIT_SUCCESS;
}


As best as I can tell, the error is a lie: I can't make that  any more
const than it already is.

ideas?

-jason pepas

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-02-29 14:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-29  8:07 const issues Jason Pepas
2008-02-29  8:13 ` Dario Saccavino
2008-02-29 15:14   ` Jason Pepas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).