oae@intrin.UUCP (02/20/87)
I have a problem. I generated a program with lex on ULTRIX and moved that program to VMS. On VMS I got an error message from the next line: FILE *yyin = {stdin}, *yyout = {stdout}; The VMS's C compiler didn't translate these initializations, because stdin and stdout are variables on VMS. On ULTRIX they are constants. Then I examined The Father, The Son and The Holy Ghost and found the following: 1. The K&R, p 153, says: "The file pointers stdin and stdout are pre-defined in the I/O library as the standard input and standard output; they may be used anywhere an object of type FILE * can be. The are constants, however, not variables, so don't try to assign to them." 2. Harbison, Steele: A C Reference Manual, p 316, says: "11.5.32 stdin ..., the external variable stdin will contain a stream that..." "11.5.33 stdout ..., the external variable stdout will contain a stream that..." 3. As for I know the draft ANSI C standard says that stdin, stdout and stderr are expressions. So, are they constants, variables or expression? I think that The K&R has the only right definition for stdin, stdout and stderr, the others are wrong. Olavi Eerola oae@intrin.uucp Intrinsic Oy Aleksis Kiven katu 11 C SF-33100 Tampere, Finland +358-31-132800