TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: ROGER SCUDDER
from: JERRY COFFIN
date: 1997-09-12 23:16:00
subject: Signs of numbers

On (11 Sep 97) Roger Scudder wrote to Jerry Coffin...
 JC> if an inline function will work, it's better than a macro.  It
 JC> will generally eliminate the same function call overhead that a
 JC> macro is usually intended to eliminate.
 RS>  But inline is only a request.  The compiler does not have to
 RS>  place the code inline.
That's why I said will _generally_ eliminate the overhead.  It doesn't
always, though it's been my experience that compilers (at least the ones
I've used) are pretty good at determining when a function is doing
enough that the call/return overhead is too small to worry about.
 RS>  Would the same apply to a macro?  In other words... even though
 RS>  the preprocessor expands the code inline the compiler could treat
 RS>  it as if it were a function call?
Yes, though in honesty this is far less common.  Typical examples would
be C interpreters and P-code compilers.  I don't know of any compilers
that actually directly find common sections of code and put them into
functions.  However, for a lot of purposes, that'd probably be more
useful than inlining control.  (Then again, it's also a lot more
difficult to do...)
    Later,
    Jerry.
--- PPoint 1.90
---------------
* Origin: Point Pointedly Pointless (1:128/166.5)

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™.