From: utzoo!watmath!idallen Newsgroups: net.unix-wizards Title: Naming Conventions for System Libraries Article-I.D.: watmath.3466 Posted: Mon Sep 13 12:12:38 1982 Received: Tue Sep 14 00:02:19 1982 How can the C programmer avoid accidentally re-defining an existing C Library function, making it unusable by other C Library functions that need it? How can the programmer avoid accidentally re-defining or using an external needed by the Library? For example, if the programmer didn't know that getlogin() used ttyslot(), s/he might accidentally redefine ttyslot() to be something peculiar. Then getlogin() would fail. Similarly, an accidental re-definition of _doprnt() would render printf() useless. Currently, the only way to avoid this problem is to remember ALL function and external names used in the library, and to avoid these names in our programs. It is probably too late to change the way things work with the existing C library; this is an appeal to future language designers. Somewhere in C history, all the C Library function names should have been renamed to include some special character (or have some special naming convention). Programmers should have been told that this special convention was used to name C Library routines, and that they were NOT to use any externals or function names that used this convention (unless they were specifically replacing the C Library function with their own). If this convention, or a similar one, were followed, programmers would never need to worry about accidentally replacing C library functions with their own. This is the *only* way programmers can avoid accidentally replacing *future* library functions. A special character convention would allow names like: $printf() str$len() get$uid() get$pwent() ... (For the B Language used here at Waterloo, we chose the period as our special character. All B Library function names contain a period.) I don't know if there are any free characters in the C character set that would allow this change to take place. The underscore would be a good-looking character to use, but it's probably been used a lot by people already. Adopting a convention that all library names should *start* or *end* with a character (e.g. Xprintf) doesn't appeal to me. The next time a library-based language gets built, I hope someone thinks of the memory burden of the programmer. -IAN! U of Waterloo (decvax!watmath!idallen)