home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / cplus / 18073 < prev    next >
Encoding:
Text File  |  1992-12-16  |  1.7 KB  |  51 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!taumet!steve
  3. From: steve@taumet.com (Steve Clamage)
  4. Subject: Re: register variables in inline functions
  5. Message-ID: <1992Dec16.183627.25945@taumet.com>
  6. Organization: TauMetric Corporation
  7. References: <1992Dec14.174511.19388@cci632.cci.com> <1992Dec15.192533.26033@vedge.com>
  8. Date: Wed, 16 Dec 1992 18:36:27 GMT
  9. Lines: 40
  10.  
  11. hendrik@vedge.com (Hendrik Boom) writes:
  12.  
  13. >dwr@cci632.cci.com (Donald W. Rouse II) writes:
  14. >: In article <1992Dec10.003109.25441@bilver.uucp> dandrews@bilver.uucp (Dave Andrews) writes:
  15. >: >>
  16. >: >My understanding is that both "register" and "inline" may be ignored
  17. >: >by your compiler.  They are only hints.
  18. >: 
  19. >: MY understanding is that "inline" may be replaced with "static",
  20. >: but it may not be ignored.
  21.  
  22. >In 
  23. >class foo{
  24. >    int i;
  25. >    inline int bar(){ return i;}
  26. >    };
  27. >inline cannot be replaced with static.
  28.  
  29. Can we please cut through the crap here?
  30.  
  31. Inline non-member functions have all the semantics of non-member static
  32. functions.  Inline member functions don't have the semantics of static
  33. member functions.  No one is talking about macro-replacement of 'inline'
  34. with 'static'.
  35.  
  36. It is unfortunate (you might choose a stronger word) that both the
  37. keyword and the explanatory term "static" are overloaded with several
  38. unrelated meanings in C and C++.  It results in confusion in
  39. discussions like these.
  40.  
  41. Think of non-member "inline" functions as being declared "static".
  42.  
  43. For member and non-member functions, "inline" is a request to the
  44. compiler that they be implemented more efficiently.  You may or may
  45. not have your request fulfilled.  In particular, they might be
  46. expanded inline, but result in less efficient code when used
  47. indescriminately.
  48. -- 
  49.  
  50. Steve Clamage, TauMetric Corp, steve@taumet.com
  51.