home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / cplus / 18684 < prev    next >
Encoding:
Text File  |  1993-01-04  |  1.8 KB  |  37 lines

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