Another example with C++ 5.6 and ladebug 4.0-33.
C lets me do it -- I can look at the results in the program. But
ladebug won't let me do it:
struct A {
int data;
};
struct B {
int data;
int more_data;
} b;
A* a = (A*) &b;
main() {}
---------------------------------------------------------------------
% ladebug a.out
Welcome to the Ladebug Debugger Version 4.0-33
------------------
object file name: a.out
Reading symbolic information ...done
(ladebug) stop in main
[#1: stop in int main(void) ]
(ladebug) run
[1] stopped at [int main(void):12 0x120001b34]
12 main() {}
(ladebug) p a
0x1400002a0
(ladebug) p *a
struct A {
data = 0;
}
(ladebug) p (A*) &b
Cannot coerce pointers to incompatible classes
Unable to cast B* to A*
Error: no value for (A *)&b
- Matt
|