TH> Passing C++ variables to assembley can be tricky. [...]
TH> how does one access a class private data member?
There are very few restrictions placed upon the actual representation of
class instances. You are guaranteed that non-static data members that are
not separated by intervening access specifiers will have addresses that
compare in the same order that they are declared, but not much more.
Specifically, you are not guaranteed *anything* about the location of a
non-static data member with respect to the start of the class object.
Although some C++ implementations do document the layout of their class
objects (MetaWare High C++ devotes a whole section to it, for example) for
the benefit of those wanting to mix assembly language and C++, they aren't
required to, and they aren't required to stick to that layout in the future.
¯ JdeBP ®
--- FleetStreet 1.19 NR
---------------
* Origin: JdeBP's point, using Squish (2:440/4.3)
|