Hi John,

 See below...

>
> Well, I am trying to compile a program on Linux, so maybe...
>
> Anyway, I got (didn't write) a program off of the Internet. It is
> actually the output from yacc. There is a statement which does not
> compile:
>
> FILE *msgout=stderr;
>
> error: initializer element is not constant
>
> I'm not really very good with C. Any help? Or tell me to just go away.
> [grin]
>
> Also, just for fun, if I try to use bison instead of yacc to preprocess
> to C, I get a ton of errors. Not asking for help, just thought I'd
> mention it.
>

 You should look at the definition/declaration of 'stderr' and
 see what it is..

 In the past, 'stderr' was simply a declaration like:

        extern FILE *stderr;

 however, the C99 standard allows these to be macros that
 expand into whatever-is-needed.   In some environments,
 the 'stderr' macro expands into a function call.

 And, from the error message, I'm guessing this is a file-scoped
 symbol, which can't be initialized with a non-static value.

 Take a look at /usr/include/stdio.h and see what 'stderr'
 expands to to get an idea of what is going on here.

 But - what it comes down to is that the programmer has
 assumed that 'stderr' is a compile-time constant, when the C99
 standard indicates it doesn't have to be; so the program
 is in error.

        - Dave Rivers -

--
[EMAIL PROTECTED]                        Work: (919) 676-0847
Get your mainframe programming tools at http://www.dignus.com

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390

Reply via email to