Thread (1 message) 1 message, 1 author, 1999-11-03

Re: compile-error: stdin is not a constant

From: Daniel Jacobowitz <hidden>
Date: 1999-11-03 16:59:03

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@debian.org         |  |       dmj+@andrew.cmu.edu      |
\--------------------------------/  \--------------------------------/

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help