4 ms·
Ok, suspicion confirmed after watching: The code snippet itself is basically useless but is a segue into how memory and caches and table walks are arranged as w
by PennRobotics 3y ago
Ok, suspicion confirmed after watching: The code snippet itself is basically useless but is a segue into how memory and caches and table walks are arranged as well as "tip of the iceberg" tool and technique recommendations, including cachegrind and gdb and presumably Godbolt, who gets an early mention.
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.
- deleted 3y ago[deleted]
- sargstuff 3y agoAll C programs do the same thing: look at a character and do nothing with it. —Peter Weinberger [0] 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 [1] : http://www.gnu.org/fun/jokes/paging.game.html http://www.gnu.org/fun/jokes/paging.game.html