Message-Id: <3.0.16.19980113112429.1c373728@hem1.passagen.se> Date: Tue, 13 Jan 1998 11:24:32 -0500 To: Eli Zaretskii From: Peter Palotas Subject: Re: getopt() and ANSI? Cc: djgpp AT delorie DOT com Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Precedence: bulk At 10.43 1998-01-13 +0200, you wrote: > >On Mon, 12 Jan 1998, Peter Palotas wrote: > >> (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. > >-ansi -pedantic *is* the way to test this. And I was wrong: GNU >`getopt' seems indeed to be ANSI-compatible. Well, only problem are two warnings... "Implicit declaration of strncmp" and "Comparation between signed and unsigned"... The comparation probably isn't much to do about, since I assume that it's okay on some systems, but would you recommend adding "#include " to the getopt.c file to get rid of the first warning, or should I just leave it the way it is? (Do any compilers produce errors instead of warnings for implicit declarations?) >Yes, but you don't mention getopt.o twice on the link command line. >You say something like this: > > gcc -o foo ... getopt.o libc.a > >The second instance of getopt.o lives inside libc.a, but the linker >won't pull it from there since by the time it gets to the library, >the symbol `_getopt' is already resolved by the code from getopt.o. >So the linker doesn't have any reason to complain. Is this a portable solution, i.e. does all linkers work this way? -- 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! * *****************************************************