TITLE: namespaces and cxxxx header files (Newsgroups: comp.lang.c++.moderated, 9 Apr 97) GANI: Tanveer Gani [...] >|> 3. In general, are the contents of headers to be >|> wrapped in namespace std { } ? >|> VANDEVOORDE: David Vandevoorde >> Yes. (Modulo certain things that are sometimes implemented >> as macros, if I remember well.) KANZE: James Kanze >What things? According to the C standard: *any* of the functions may be >implemented as a macro. Note however: > > #include > > if ( isalpha( c ) ) // legal if macro, illegal if function > if ( std::isalpha( c ) ) // legal if function, illegal if macro CLAMAGE: Stephen.Clamage@Eng.Sun.COM (Steve Clamage) Partly correct. According to the C standard (7.1.7 Use of Library Functions), any function may be *additionally* implemented as a macro. The functions must in all cases be implemented as functions, and you can force a reference to the actual function by #undef-ing the macro or by enclosing the function name in parens. Example C code: #include isalpha(c) /* might be a macro */ (isalpha)(c) /* calls the function */ #undef isalpha /* allowed even if isalpha is not a macro */ isalpha(c) /* cannot now refer to a macro */ The C++ standard (in 17.3.1.2 Headers) forbids the implementation of C library functions as macros. A C++ version of a C header should make functions inline that would otherwise be macros.