Hello,
When building dtmail with gcc 4.2 I get the following warning:
making all in programs/dtmail/MotifApp...
rm -f Application.o
CC -c -O -Wno-write-strings -I../include/MotifApp -I../include
-I../include/utils -I../../.. -I../.
./../exports/include -I../../../imports/motif/include
-I../../../imports/x11/include -DCSRG_BASED -
DANSICPP -DMULTIBYTE -DNLS16 -DOSMAJORVERSION=9 -DOSMINORVERSION=0
Application.C
Application.C:83: warning: invalid access to non-static data member
'Application::_appWorkspaceList' of NULL object
Application.C:83: warning: (perhaps the 'offsetof' macro was used incorrectly)
Application.C is here:
79 XtResource
80 Application::_appResources[] = {
81 {
82 "workspaceList", "WorkspaceList", XtRString, sizeof(XtRString),
83 XtOffset(Application *, _appWorkspaceList), XtRString, (XtPointer)
NULL
84 }
85 };
The class is declared as follows:
82 class Application : public UIComponent {
83
...
87
88 private:
...
95 protected:
97 // Functions to handle Xt interface
98 virtual void initialize ( int *, char ** );
99 virtual void handleEvents();
...
106 static XtResource
107 _appResources[];
108 char *_appWorkspaceList;
109 int _bMenuButton;
...
119 public:
120
121 Application ( char * );
122 virtual ~Application();
...
163 };
C++ websites say that offsetof() shouldn't be used
on more complex classes like those having virtual
methods. Here's that info file to my GCC says:
`-Wno-invalid-offsetof (C++ only)'
Suppress warnings from applying the `offsetof' macro to a non-POD
type. According to the 1998 ISO C++ standard, applying `offsetof'
to a non-POD type is undefined. In existing C++ implementations,
however, `offsetof' typically gives meaningful results even when
applied to certain kinds of non-POD types. (Such as a simple
`struct' that fails to be a POD type only by virtue of having a
constructor.) This flag is for users who are aware that they are
writing nonportable code and who have deliberately chosen to
ignore the warning about it.
The restrictions on `offsetof' may be relaxed in a future version
of the C++ standard.
Shall we worry about this in this case?
There few other classes that have this problem, too.
//Marcin
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
cdesktopenv-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdesktopenv-devel