delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/04/08/18:06:57

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-Id: <199904082205.RAA13640@modi.xraylith.wisc.edu>
X-Authentication-Warning: modi.xraylith.wisc.edu: localhost.xraylith.wisc.edu [127.0.0.1] didn't use HELO protocol
To: "Vincent P. LaBella" <vlabella AT comp DOT uark DOT edu>
cc: Cygwin List <gnu-win32 AT cygnus DOT com>
Subject: Re: Success porting GLE/Troubles with Bibtool
In-reply-to: Your message of "Thu, 08 Apr 1999 16:43:49 CDT."
<Pine DOT SOL DOT 3 DOT 95 DOT 990408163238 DOT 23983A-100000 AT comp>
Date: Thu, 08 Apr 1999 17:05:48 -0500
From: Mumit Khan <khan AT xraylith DOT wisc DOT EDU>

"Vincent P. LaBella" <vlabella AT comp DOT uark DOT 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 AT sourceware DOT cygnus DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019