Which combined with C++ default of 64 bit pointers can give some interesting results.
I did not expect this:
Code: Select all
$ type sixtyfour.cpp
#include <cstdint>
#include <iostream>
using namespace std;
#include <smg$routines.h>
class Test
{
private:
int32_t kbid;
public:
Test()
{
cout << "ctor called" << endl;
int32_t stat = smg$create_virtual_keyboard(&kbid);
cout << "stat=" << stat << endl;
}
virtual ~Test()
{
cout << "dtor called" << endl;
int32_t stat = smg$delete_virtual_keyboard(&kbid);
cout << "stat=" << stat << endl;
}
};
void test1()
{
Test o;
}
void test2()
{
Test *o = new Test();
delete o;
}
int main()
{
test1();
test2();
return 0;
}
$ cxx sixtyfour
$ link sixtyfour
$ run sixtyfour
ctor called
stat=1
dtor called
stat=1
ctor called
%SYSTEM-F-ACCVIO, access violation, reason mask=04, virtual address=FFFF830008AB65CC, PC=0000000000000001, PS=432B2B02
-RSX-W-NOMSG, Message number 00066C20
%TRACE-F-TRACEBACK, symbolic stack dump follows
image module routine line rel PC abs PC
sixtyfour 0 000000008000007F 000000008000007F
sixtyfour 0 000000008000008D 000000008000008D
sixtyfour 0 00000000800000D1 00000000800000D1
PTHREAD$RTL 0 000000008003F28C FFFF830008CFF28C
PTHREAD$RTL 0 0000000080000331 FFFF830008CC0331
0 FFFF8300071C81C6 FFFF8300071C81C6
DCL 0 000000008006632B 000000007ADC432B
%TRACE-I-END, end of TRACE stack dump
$ cxx/pointer=32 sixtyfour
$ link sixtyfour
$ run sixtyfour
ctor called
stat=1
dtor called
stat=1
ctor called
stat=1
dtor called
stat=1
Strictly speaking it is P0/P1 vs P2 not pointer size, but the latest C++ new allocate in P0 or P2 depending on pointer size.