Posts

Showing posts with the label programming
Image
  While disappointing that the modern industry emphasizes contrived programming problems instead of creating solutions like we did 20 years ago, it's still impressive what kinds of ASCII graphics demos have been created. These use extremely simple insights into the way trig functions work & show the kind of optimization necessary to make good C64 demos.  It's not all raster interrupt handlers & racing the beam.
Image
 container_of is a horror story of what can happen when you try to get away from using pointers to the point of creating something far more confusing than pointers.  In the old days, a function would typically take a pointer to a structure & a pointer to the parent of the structure.  It would save stack space & run faster to only pass 1 argument to the function, then reverse engineer the parent from knowledge of the type of the function argument. The 1st goog result is https://radek.io/2012/11/10/magical-container_of-macro/ undoubtedly by someone who has retired by now.  The prototype for future lion reference is: container_of(ptr, type, member) ptr is the function argument. type is the type of the parent structure. member is the name of the ptr as it appears in the parent structure. The example usage begins with our function prototype: void vos_linux_timer_callback (struct timer_list *t) { Then to get the parent structure of *t. vos_timer_plat...