J
james.p.williams
I'm using Young's book on mixing C++ and Motif. In it, he says to use
XtGetSubresources() to be able to configure member data using the X
resource database. When I try this, based on Young's example,
class MyComponent: public UIComponent
{
...
private:
unsigned char _orientation
static XtResource _customResources[];
...
}
XtResource MyComponent::_customResources[]={
{
"orientation",
"Orientation",
XmROrientation,
sizeof(unsigned char),
XtOffsetOf(MyComponent,_orientation),
XmRString,
(XtPointer)"HORIZONTAL"
},{
...
}
};
I get compiler warnings about the above call to the XtOffsetOf()
macro.
% g++ -Wall -Wunused -W -ansi -pedantic -c MyComponent.C
MyComponent.C:116: warning: invalid offsetof from non-POD type
`class MyComponent'; use pointer to member instead
I understand the pointer to member syntax, but am not sure how to use
it here to appease the compiler. Is there a correct, portable, safe
way to do this?
Thanks,
Jim Williams
XtGetSubresources() to be able to configure member data using the X
resource database. When I try this, based on Young's example,
class MyComponent: public UIComponent
{
...
private:
unsigned char _orientation
static XtResource _customResources[];
...
}
XtResource MyComponent::_customResources[]={
{
"orientation",
"Orientation",
XmROrientation,
sizeof(unsigned char),
XtOffsetOf(MyComponent,_orientation),
XmRString,
(XtPointer)"HORIZONTAL"
},{
...
}
};
I get compiler warnings about the above call to the XtOffsetOf()
macro.
% g++ -Wall -Wunused -W -ansi -pedantic -c MyComponent.C
MyComponent.C:116: warning: invalid offsetof from non-POD type
`class MyComponent'; use pointer to member instead
I understand the pointer to member syntax, but am not sure how to use
it here to appease the compiler. Is there a correct, portable, safe
way to do this?
Thanks,
Jim Williams