home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / cplus / 18325 < prev    next >
Encoding:
Text File  |  1992-12-22  |  1.6 KB  |  40 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!udel!rochester!rit!cci632!dwr
  3. From: dwr@cci632.cci.com (Donald W. Rouse II)
  4. Subject: Re: register variables in inline functions
  5. Message-ID: <1992Dec22.205531.26786@cci632.cci.com>
  6. Organization: [Computer Consoles, Inc., Rochester, NY
  7. References: <1992Dec14.174511.19388@cci632.cci.com> <1992Dec15.192533.26033@vedge.com>
  8. Date: Tue, 22 Dec 1992 20:55:31 GMT
  9. Lines: 29
  10.  
  11. In article <1992Dec15.192533.26033@vedge.com> hendrik@vedge.com (Hendrik Boom) writes:
  12. >dwr@cci632.cci.com (Donald W. Rouse II) writes:
  13. >: In article <1992Dec10.003109.25441@bilver.uucp> dandrews@bilver.uucp (Dave Andrews) writes:
  14. >: >In article <1992Dec9.011428.11178@aplcen.apl.jhu.edu> ded@aplcen (nod sivad) writes:
  15. >: >My understanding is that both "register" and "inline" may be ignored
  16. >: >by your compiler.  They are only hints.
  17. >: >
  18. >: MY understanding is that "inline" may be replaced with "static",
  19. >: but it may not be ignored.
  20. >
  21. >In 
  22. >class foo{
  23. >    int i;
  24. >    inline int bar(){ return i;}
  25. >    };
  26. >inline cannot be replaced with static.
  27.  
  28. I forgot that you can explicitly declare member functions inline.
  29. (In your example, "inline" is implied.)
  30. I was thinking about non-member functions.
  31. Non-member functions declared as "inline"
  32. may be treated as "static" by the compiler
  33. (scopewise, it _must_ be treated as "static").
  34. The compiler may not simply ignore "inline" in that case,
  35. since the function name would then have global scope.
  36. If by ``"inline" may be ignored'' you meant that
  37. the compiler does not actually have to put the
  38. function body inline where it is invoked,
  39. I agree with you.
  40.