non-standard functions in libc -- bad design?

J

jameskuyper

blmblm said:
I'll say. I've just made an attempt to read, in the C standard
at http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf,
what it means to be a conforming implementation .... Have I got
this straight:

A conforming implementation can include functions that are not
part of the standard library, but if it does, the names of these
functions can't be ones that could appear in strictly-conforming
programs. ?

Correct; programs that make use of those names are not strictly
conforming. "strictly conforming" is about portability. You wouldn't
expect a program that uses such names to be portable to a compiler
that does not define them (or worse, gives them incompatible
definitions), would you?
And .... POSIX defines some functions that are not C-standard but
also don't follow this rule?

Correct.
 
L

lawrence.jones

A conforming implementation can include functions that are not
part of the standard library, but if it does, the names of these
functions can't be ones that could appear in strictly-conforming
programs. ?

Not quite -- the names can be anything so long as they don't cause
strictly conforming programs to behave incorrectly. So, it's perfectly
OK to provide a function named "open", for example, provided it doesn't
cause any problems for a strictly conforming program that contains its
own "open" function (like because there's a prototype for it in
<stdio.h> that might conflict with the user's definition or because the
standard fopen library function tries to call it and gets the user's
function instead).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top