Re: pb compiling with gcc-2.7.2.3-3
Eric Delaunay wrote:
> I've tracked the problem down to the following source I cannot compile:
> -------cut here--------
> #include <stdio.h>
> FILE *out = stdout;
> main()
> {
> fprintf( out, "hello\n" );
> }
> -------cut here--------
>
> $ gcc toto.c
> toto.c:2: initializer element is not constant
I think I discovered the problem:
.stdout is only declared, in stdio.h (from libc6), as
extern FILE* stdout
.in libc5, it was declared like this:
/* stdio.h */
#define stdout _IO_stdout
/* libio.h */
extern struct _IO_FILE_plus _IO_stdout_;
#define _IO_stdout ((_IO_FILE*)(&_IO_stdout_))
.the latter declaration is resolved to the address of a global structure at
compile time, so results in a constant, but the former is only a pointer
whose contents is unknown at compile time.
Such constructs have now be rewritten like that:
-------cut here--------
#include <stdio.h>
FILE *out;
main()
{
out = stdout;
fprintf( out, "hello\n" );
}
-------cut here--------
Bye.
--
Eric Delaunay | "La guerre justifie l'existence des militaires.
delaunay@lix.polytechnique.fr | En les supprimant." Henri Jeanson (1900-1970)
--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-sparc-request@lists.debian.org .
Trouble? e-mail to templin@bucknell.edu .
Reply to: