public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* virtual inline vs inline
@ 2013-11-04 13:33 Norbert Dajka
  2013-11-04 14:51 ` Jonathan Wakely
  0 siblings, 1 reply; 2+ messages in thread
From: Norbert Dajka @ 2013-11-04 13:33 UTC (permalink / raw)
  To: gcc-help

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.

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)?

Best regards,

Norbert

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: virtual inline vs inline
  2013-11-04 13:33 virtual inline vs inline Norbert Dajka
@ 2013-11-04 14:51 ` Jonathan Wakely
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2013-11-04 14:51 UTC (permalink / raw)
  To: Norbert Dajka; +Cc: gcc-help

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-11-04 14:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-04 13:33 virtual inline vs inline Norbert Dajka
2013-11-04 14:51 ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).