olin_piclist@embedinc.com (Olin Lathrop) wrote: > Gerhard Fiedler wrote: > > In a sensibly designed language, the user wouldn't create names in > > the same namespace where the standard library function names are. > > None of the mainstream languages I've used had a reserved namespace for > standard library functions. In fact, C is unusual with its notion of > standard library functions. I think that's what's special about C relative to most other compiled languages. Yes, there's a "standard C library", but it is in fact completely distinct and separable from the language/compiler itself. You can write major applications -- especially embedded applications -- in C without even once calling a standard library function. I know, because I've done it. I've even replaced parts of "crt.s" (implicit code in the library that sets up the environment for and supports the compiled code, usually in assembly language) without fuss. Some of the participants in this thread are downplaying the whole notion of separate compilation with an explicit linking step that is actually a fairly key part of C. This is what allows you, for example, to replace a standard library function wtih a custom implementation, again, with little to no fuss. Suppose you don't need the full-blown functionality of printf(), with its dependency on the floating-point library, etc. Just write your own and link it in ahead of the standard library and it will be used instead. > Some operating systems take care to use special naming for their routines > that are easily avoided by the user, but unfortunately Unix and Windows > are not among them. The standard C library routines and Unix routines > are particularly bad in this regard. Well, now you're conflating several issues, few of which have anything to do with the actual definition of the language. Library naming issues are a problem in any language. Again, I think C does fairly well in this area because of the separate compilation. You can easily limit the scope of any particular set of names down to a particular file if you need to. Setting up the linking sequence may then takes some care, and you have to learn how to avoid circular dependencies at that level. But once a project gets to this level of complexity, the issues are largely independent of the particular language(s) in use. -- Dave Tweed -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist