Re: Function pointers to inline functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Shriramana Sharma wrote:

> >> I mean, if I use -fkeep-inline-functions to get the function output in 
> >> the object file, and if the static keyword also meant that the function 
> >> is visible only in the translation unit in which it appears, then 
> >> -fkeep-inline-functions would be rendered useless, 
> 
> ... in the case of static inline functions.

Non-static inline functions are always generated so that they can be
called from other translation units. It's only when a function is both
static and inline that you can (normally) eliminate the function body
altogether.

> Is this correct or no?
> 
> Would a function visible only in its translation unit be accessible from 
> a debugger, as you say?

Yes.

The debugger might still require the function to be in scope (i.e. the
active stack frame must be in the same translation unit) in order to
call it, but that's down to how the debugger resolves symbols which
are entered by the user.

gdb doesn't have this requirement.

> I would test it myself, but I haven't any idea 
> how to load just a single object file in gdb and test it so I am asking.

Add a minimal main.c so that you can run it as a program.

-- 
Glynn Clements <glynn@xxxxxxxxxxxxxxxxxx>
-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux