4 ms·
> struct stuff{ int a; int b; }; Doesn't teach me anything about memory layout. Maybe not, but this does: offsetof(struct stuff, a); offsetof(struct stuff
by haberman 14y ago
> struct stuff{ int a; int b; }; Doesn't teach me anything about memory layout.
Maybe not, but this does:
offsetof(struct stuff, a);
offsetof(struct stuff, b);
sizeof(struct stuff);
> C assumes you are running on some hardware from the 70s, it doesn't know about virtual memory, address spaces, memory pages, NUMA, ram with multiple channels, the no execute bit, GPGPU programming.
I'm not sure what you're complaining about; virtual memory is explicitly designed so that no code (even assembly language) "knows" about it except for the very small amount of code that sets it up. Likewise with most of the features you are mentioning. A memory reference in C operates at about the same level of abstraction in C as it does in assembly language, which is the lowest-level software interface available.