compile-error: stdin is not a constant

Daniel Jacobowitz drow at false.org
Thu Nov 4 03:59:03 EST 1999


On Wed, Nov 03, 1999 at 05:53:59PM +0000, Martin Costabel wrote:
> Maybe this will work (1):
> 
> FILE *foo = (FILE *) STDIN_FILENO;


No no no no no!  STDIN_FILENO is a -number-, not a -pointer-!

> In a similar situation, I learned from Tom Rini that the correct way
> would be (2)
> 
> static file *file ;
> static void file_construct (void) __attribute__((constructor));
> static void file_construct (void) { file = stdin; }

Yes, that's it.  gcc specific, but works.  (1) is DEFINITELY wrong.


Dan

/--------------------------------\  /--------------------------------\
|       Daniel Jacobowitz        |__|        SCS Class of 2002       |
|   Debian GNU/Linux Developer    __    Carnegie Mellon University   |
|         dan at debian.org         |  |       dmj+ at andrew.cmu.edu      |
\--------------------------------/  \--------------------------------/

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc-dev mailing list