by PennRobotics · 3y ago · 0 comments
For embedded, this might do something nonawful on a device with memory management e.g. Cortex-A. This exercise is left to the reader.
Moral of the talk? Most of computing is extremely complicated, and you can hand-wave and abstract much of it away unless it's directly in your field. In this case, that would be a compiler engineer or low-level kernel developer.
Humorous 'memory' explaination of various levels of 'memory'[1]
Without reviewing the video, looks like a coding artifact related to segment 64k memory of 8/16/32/64 bit dos/MS windows (vs. arm / sparc with flat address space).
far/near pointer delclaration would clarify things a bit.
This is a c language artifact. Using in C++, one would need to impliment/override the default C++ supplied memory management to avoid memory management gotchas.
The code example was a way to make sure that pointer variable on a non-unified memory architecture was initialized to point within a given memory segment.
aka Reference zero's out the non-unique bits and leaves the "memory reference bits for given memory segment" alone / segmented NULL.
Zeroing out the non-unique memory bits still allows one to make use of the upper address bits to find out where in memory the given
memory segment is (useful for implimentation of setjump(), figuring out machine byte order, 1st time in segment, etc.).
[0] : Expert C Programming, Deep C Secrets by Peter Weinberger