Hi Wang Rui, Sorry for the slow reply. Lack of expertise in the area of VS #pragma makes it awkward for me to provide any authoritative view, so I'm in a listening and learning mode :-)
I've just reviewed your changes and I feel that the use of push and pop isn't something that is prone to errors in maintenance - I see the copy and paste anti-pattern strike the OSG code base all too often, and coding practices like this raise the stakes. Adding #if's around the pragma would exacerbate this issue, but just upping the number of lines of code required just to fix a warning. Would it be possible to set a compiler flag to set the packing setting? Would setting the packing size to 16 all the serializer plugins lead to a significant inflation in memory size of the wrappers? I'm wondering if we can't just add CMake settings to address this issue, this way the change would be limited to a line or two in the CMakeLists.txt, rather than spread out in source files. Thoughts? Robert. On Wed, Mar 24, 2010 at 2:58 PM, Wang Rui <[email protected]> wrote: > Hi Robert, > > This is from a discussion in a private letter between us a fews days > before. It seems that you didn't receive my replies. So I'd like to > post one of my solutions to osg-submissions. Hope it helps before I > finished the osgAnimation wrappers in about a week. :) > > The serializer header causes a windows warning C4121 at present. I've > done some tests and could avoid this in two ways: One is to disable > the warning directly, and the other is to use '#pragma pack' directive > in each NodeCallback derived class wrappers. I modified attached > wrapper files which have warnings with: > > #pragma pack(push, 16) > ... > #pragma pack(pop) > > And it compiles fine. The only potential problem is that more memory > spaces will be used when wrapping these classes (default packing > alignment is 8), but it is believed to be of no harm at present. On > another hand, a small value may cause Windows system exceptions. I > also tested with the value 1 and it crashes while converting to > osgt/osgb files. > > The '#pragma pack' command may not work for all platforms. Maybe we > could add a '#ifdef' statement to handle this. > > I'm also working on a new OSG publication. And I would like to keep > you informed and call for advices and resources if you and the > community have interests. :) > > Cheers, > > Wang Rui > > _______________________________________________ > osg-submissions mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org > > _______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
