www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/12/17:20:48

Message-Id: <3.0.16.19980112231015.199705b0@hem1.passagen.se>
Date: Mon, 12 Jan 1998 23:10:19 -0500
To: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
From: Peter Palotas <blizzar AT hem1 DOT passagen DOT se>
Subject: Re: getopt() and ANSI?
Cc: djgpp AT delorie DOT com
Mime-Version: 1.0

At 19.24 1998-01-12 +0200, you wrote:
>
>On Mon, 12 Jan 1998, Peter Palotas wrote:

>> If not, how would I go about to make my program which
>> uses getopt to be ANSI compliant? Would it be a good idea, simply to
>> include the GNU getopt.c and getopt.h files?
>
>Yes, but: (1) using GNU `getopt' makes your program GPL; and (2) nobody 
>said that GNU getopt sources are strict ANSI (I think they are not).

(1)My program will be GPL anyway, so that is of no concern.
(2)How would I make sure that they are ANSI? Is there some program out
there which can find out wether a program is ANSI or not? By the way, the
GNU `getopt' compiles fine with -ansi -pedantic, but this isn't bulletproof
I guess.


>The best alternative would be to roll your own version, but it's a lot of 
>work...

Yeah, I don't feel like reinventing the wheel today.


>> Wouldn't there be a conflict when linking since getopt is included in
>> the C library somewhere as I've understood it!? 
>
>Of course, there will be no conflict.  Otherwise, how would we be able to 
>link all the GNU packages that use their `getopt'?  
>
>Since getopt.o (fgrom GNU) is mentioned on the link command line *before* 
>libc.a, it gets linked instead of the DJGPP version.  And the interface 
>is compatible, so no conflict here.

The interface is compatible? What do you mean by that?  As far as I know,
most compilers complain if the same symbol is defined twice no matter where
it is put on the commandline, isn't it so in this case?

-- Peter Palotas alias Blizzar -- blizzar AT hem1 DOT passagen DOT se --

*****************************************************
* A brief description of DJGPP:                     *
* NEVER BEFORE HAS SO FEW DONE SO MUCH FOR SO MANY! *
*****************************************************

- Raw text -


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