This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: virtual inline vs inline


On 4 November 2013 13:33, Norbert Dajka wrote:
> Hello,
>
> I would like to know, if there is any difference (in allocated memory
> space) between defining a function inline in the class declaration
> (with the inline word), and defining a function inline explicit after
> the class declaration.

There is no difference.

> In addition, does anybody know, why a previously only inline declared
> function takes up more memory space, if it's declared virtual inline
> (even if the classes to which the declaring class of the function is a
> parent class doesn't have their own implementation)?

Because virtual functions need additional metadata in the class,
specifically in the ABI used by G++ the class must have a pointer to
the vtable (if it didn't have one already) and the vtable will have an
additional entry for the virtual function.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]