home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!microsoft!hexnut!jimad
- From: jimad@microsoft.com (Jim Adcock)
- Subject: Re: Standard library functions and macros
- Message-ID: <1993Jan04.215652.5051@microsoft.com>
- Date: 04 Jan 93 21:56:52 GMT
- Organization: Microsoft Corporation
- References: <930101234006_76336.3114_EHJ42-1@CompuServe.COM>
- Lines: 26
-
- In article <930101234006_76336.3114_EHJ42-1@CompuServe.COM> 76336.3114@CompuServe.COM (Kevin Dean) writes:
- |>If this is not acceptible, then simply don't include that standard header
- |>file.
- |
- |All well and good but I've seen some compilers (Microsoft's among them)
- |that, with certain optimizations turned on, reserve the function name
- |anyway even though its corresponding header has not been included. (I
- |don't know if this applies to MSC 7.0 since I haven't played with it yet
- |but it was certainly the case with 6.0).
-
- What you refer to is compiler support for certain intrinsic functions,
- if you have the option on for the compiler to supply you with these
- intrinsic functions. An example being that the compiler supplies you
- with highly-optimized inline code to do a strcpy, for example.
-
- What happens in a C program with intrinsics turned on, and the header
- not included, is that the first use of strcpy *implicitly* defines the
- function, as is C tradition. Then the compiler-supplied intrinsic function
- matches your implicit declaration of the function. If it weren't for the
- intrinsic you'd still get an "accidental" match to the strcpy in the C
- standard libraries -- unless you don't link to the C standard libraries either.
-
- Note that this is not the same with a C++ program. C++ does not allow
- implicit declarations of functions. So, without the header included in
- C++ you get an error message that the function is used without being defined.
- No problem there.
-