TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: ROGER SCUDDER
from: CHRIS DOWNS
date: 1997-09-16 07:03:00
subject: Re: Signs of numbers

 RS> But inline is only a request.  The compiler does not have to
 RS> place the code inline.   
 
 True enough.  But just why is inline "only a request".  There are
 a few reasons.  First, it may not even be theoretically possible
 to inline the code.  For example, a virtual function that cannot
 be resolved until run-time clearly cannot be inlined at compile
 time.  Additionally, it may just be too large or complex of code
 to inline, so the platform is allowed to punt the inline request
 at discretion.
 But just because it is legal to ignore the inline doesn't mean that's
 how your compiler will be treating the situation.  For example,
 class X {
 private:
   int j;
   SetJ(int a) {j=a;}
   inline int GetJ();
 }
 int X::GetJ() { 
   return j;
 }
 I don't believe you would find a current compiler that would refuse
 to inline the member functions.
 
 RS> Would the same apply to a macro?  
 
 A macro just does text substitution.
 
 RS> In
 RS> other words... even though the preprocessor expands the code
 RS> inline the compiler could treat it as if it were a function
 RS> call?
 I suppose it's possible for a compiler to coalesce common 
 executable code into subroutines as some sort of optimization 
 for space.  FWIW, I haven't heard of such a thing.
---
 þ Blue Wave/QWK v2.12 þ
---------------
* Origin: St. Louis Users Group (1:100/4)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.