Prototypes and ID lists
Roger Critchlow
rec at elf115.uu.net
Wed Aug 16 02:02:57 AEST 1989
In article <10551 at smoke.BRL.MIL>, gwyn at smoke.BRL.MIL (Doug Gwyn) writes:
} In article <16803 at rpp386.Dallas.TX.US> jfh at 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 at elf115.uu.net --
More information about the Comp.std.c
mailing list