computing address of strucuture fields

Started by
-1 comments, last by Gammastrahler 20 years, 1 month ago
Hi, i´m still writing on my parser. constructs like myTriangle.plane.normal.x = 1.0; are possible. however, i´m going mad with computing the address of nested structures like this... i just can´t figure out an algorithm to perform this. it gets even more complicated if i have myTriangle[0].plane.normal[1] = 1.0; or myTriangle->plane->normal.x = 1.0; pointers and arrays require an alternate computation method, i´m just wondering how i can pack this into one recursive algorithm... i´m getting really mad! basically, each identifier has a base relative offset address to it´s function stack frame, and each field has it´s corresponding realitve address of i´ts enclosing structure. data size is also known at compile time. could someone please give some pseudo code of hoe to do this? very very big thanks in advance!! greets Gammastrahöer

This topic is closed to new replies.

Advertisement