This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project. See the Cygwin home page for more information.
Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Success porting GLE/Troubles with Bibtool


"Vincent P. LaBella" <vlabella@comp.uark.edu> writes:
> Hello,
> 
> Also, Right now I'm trying to port BiBtool, but I'm running into a problem
> which I think is Code related.  I get the error: 
> 
> error.c:45: initializer element is not constant
> 
> and line 45 from error.c is:
> 
> FILE * err_file   = stderr;

This construct, used by lots of existing old code, is simply non-portable
and should be avoided. `lex' is the biggest culprit of all!

On most systems, stderr is defined as a constant, but that's not so in
lots of newer systems. That's why these bugs are only now coming out.

If you look at the intermediate output (preprocessed file), you'll see
the above line translate to:
  
  FILE *foo = (_impure_ptr->_stderr) ;

which is obviously illegal C, regardless of what _impure_ptr happens to
be.

> I am assuming this line compiled with erlier versions of gcc (2.7...),
> since the author stopped miantaing his web page in 97.
> http://ctan.unsw.edu.au/tex-archive/biblio/bibtex/utils/bibtool/BibTool.html
> 
> The question is:  Does C allow non constant identifiers? If not, why did
> this compile with older gcc's? Is this a egcs problem/bug or is egcs begin
> correctand older gcc's just didn't catch this?

No. It depends on how the runtime defines stderr. It'll always be buggy,
or non-conformant at best.

This type of problems can always be worked around by doing the
initialization in a function that gets called early in main().

Regards,
Mumit


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com