Article View: comp.std.c
Article #345Re: Prototypes and ID lists
From: Roger Critchlow
Date: Wed, 19 Jul 1989 16:02
Date: Wed, 19 Jul 1989 16:02
25 lines
1329 bytes
1329 bytes
In article <10551@smoke.BRL.MIL>, gwyn@smoke.BRL.MIL (Doug Gwyn) writes:
} In article <16803@rpp386.Dallas.TX.US> jfh@rpp386.Dallas.TX.US (John F. Haugh II) writes:
} -Suppose I prototype a function with
} -extern struct passwd *getpwuid (uid_t uid);
} -and later in the same compilation unit have a declaration
} -struct passwd *
} -getpwuid (uid)
} -uid_t uid;
} -{
} - [ stuff ]
} -Is my [ supposedly ] ANSI-compliant compiler free to warn
} -me that getpwuid() has been redefined?
}
} But it hasn't been redefined! It's been defined just once, and
} then compatibly with the prototype declaration of its interface
} that's in scope at the point of definition.
Compatibly defined if and only if uid_t is not hiding a type which
is promoted. If
typedef unsigned short int uid_t;
then the function definition is not compatible with the prototype.
-- rec@elf115.uu.net --
Technical Details
Message-ID:
<160@elf115.uu.net>Path:
arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!cs.utexas.edu!uunet!elf115!recReferences:
<16803@rpp386.Dallas.TX.US> <10551@smoke.BRL.MIL>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!cs.utexas.edu!uunet!elf115!rec From: rec@elf115.uu.net (Roger Critchlow) Newsgroups: comp.std.c Subject: Re: Prototypes and ID lists Summary: maybe redefined, maybe not Message-ID: <160@elf115.uu.net> Date: 19 Jul 89 16:02:57 GMT References: <16803@rpp386.Dallas.TX.US> <10551@smoke.BRL.MIL> Organization: ELF, Sea Cliff, NY Lines: 25