I am having a very strange problem computing the offset of a member in a structure.
Consider this ....
In gui.c at start :-
int gConfOffset;
char *gpBaseAddress = &conf.save_raw.
char *gpMemberAddress = NULL;
In gui_dist_mode_enum() (not in CHDK) :-
gpMemberAddress=(char *)&conf.dist_mode;
gConfOffset=gpMemberAddress-gpBaseAddress;
If you print the member and base address, the calculated offset value is correct.
If similar code is put in gui_tv_enum() and :-
gpMemberAddress = &conf.tv_override
the calculated offset is incorrect !
I find that impossible to explain.
You can also use the macro :-
#define GetOffset( struct_type, member ) ((int)&((struct_type*)0)->member)
but it makes no difference.
I will try inserting the code into other enumerations.
Any possible explanation for this ?