Xref: utzoo comp.lang.c:13877 comp.lang.c++:1895 Path: utzoo!utgpu!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!agate!bionet!apple!rutgers!galaxy!dsoft!root From: root@dsoft.UUCP (Super user) Newsgroups: comp.lang.c,comp.lang.c++ Subject: Something new for C? Keywords: offset of vars within structures Message-ID: <73@dsoft.UUCP> Date: 7 Nov 88 23:40:07 GMT Organization: DragonSoft, Livingston NJ Lines: 23 Maybe I've missed something in C, but One of the things I've never found a way to do and have always wanted, was a precompiler command to allow me to use the offset of an item into a structure. for example: struct test { long this; int that; char those[8]; }; val = offset(test,that); As it is now, I have the choice to either recalculate the offset of a var in a structure, or write it into the program source. (EG: offs = &test.that - &test.this) I find myself building massive structures and constantly moving the data around within them, but I need to know the offset of certain variables to use as key table entries in a keyed file system I wrote. I'd like to have a way not to have to recalculate the offset into a structure every time I make a change. It can get very harrowing at times! Is there such a function already? or is there any plans for one?