|
![](/i/fill.gif) |
Le_Forgeron <lef### [at] free fr> wrote:
> Tetracapilli... if you compile with RTTI (default for most, including
> gnu), an instance of an empty class is already the size of a pointer: to
> the class description.
I don't know how to explain this more clearly than I have already done.
If a class has no virtual functions, it will have no vtable pointer.
RTTI has nothing to do with this.
If you have, for example, one int as its member, the size of the class
will be typically 4 bytes.
Now add a virtual function to the class: Suddenly its size is 8 bytes
(16 if compiling a 64-bit binary). The size of the class has doubled
(quadrupled in 64-bit systems).
This is the reason why vtables are added only to classes that have virtual
functions.
> In Embedded C++, there is no multiple inheritance, no C++ cast (neither
> down or up), no mutable attribut, no namespace, no exception, no
> templates and no stdio.
That sounds like a pretty useless C++.
(Why no namespaces or templates? What do those have anything to do with
embedded systems?)
--
- Warp
Post a reply to this message
|
![](/i/fill.gif) |