3 ms·
How much code out there does stuff to the effect of union MyObject { void* ptr; unsigned long data; } (...) MyObject obj; obj.ptr = (void*)so
by im3w1l 3y ago
How much code out there does stuff to the effect of
union MyObject {
void* ptr;
unsigned long data;
}
(...)
MyObject obj;
obj.ptr = (void*)some_function;
(...)
store_context(obj.data);
And what would happen to such code if pointers are suddenly fat?
- pizlonator 3y agoCHERI handles that by dynamically dropping the capability when you switch to accessing memory as int. Fil-C currently has issues with that, but seldom - maybe I've found 3 such unions while porting OpenSSL, maybe 1 when porting curl, and zero when porting OpenSSH (my numbers may be off slightly but it's in that ballpark).