Re: [osg-users] Conversion from 'GLsizeiptrARB' to 'const GLvoid *' of greater size
Hi Jean-Sébastien, Just to let you know that you're not alone to see those Warning, I'm seeing them too under VS 2008 with 32bits build... You can hide them using option : /wd 4312 Kind regards, * * 2010/1/11 Robert Osfield robert.osfi...@gmail.com Hi JS, On Mon, Jan 11, 2010 at 2:41 PM, Jean-Sébastien Guay jean-sebastien.g...@cm-labs.com wrote: So would you accept a change that pushes the warning disable state at the start of include/osg/State, disables that warning for the file, and pops the warning disable state at the end of the file? (or perhaps only in those functions would be less prone to hiding other problems) Jikes, no way. Hacks like that stays well out of general OSG headers. Disabling warnings in specific .cpp's where there are problems is acceptable. If that's not possible then placing a global disable in the CMake build or the include/osg/Export. You've refused such changes in the past, but perhaps for this case it's the only way to go... Having yet another example of how crappy compilers can be doesn't change my opinion on putting hacks into the OSG headers. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Alexandre AMALRIC Ingénieur RD === PIXXIM S.A. 73E, rue Perrin-Solliers 13006 Marseille http://www.pixxim.fr ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Conversion from 'GLsizeiptrARB' to 'const GLvoid *' of greater size
Hi, Sorry to bug you again with this topic, but I'm getting the very same warnings on my machine. I surrounded each troubling line with Code: #pragma warning(push) #pragma warning(disable : 4312) ...LINE WITH WARNING... #pragma warning(pop) but thats just cosmetics. The vertex buffer code now looks rather different from the 2.8.3 past. Can you give some insight into why this was changed (especially the Array mutable const GLvoid* _vboOffset versus BufferEntry unsigned int offset part)? I'm still not sure that the warning can be ignored. Of course compiling it for and using it on a 64bit machine works, but what happens when the code was compiled for 32 bit and is used on a 64 bit machine; wouldn't that mean that the cast of a negative int is wrongly cast to a positive 64bit pointer position (see http://msdn.microsoft.com/en-us/library/h97f4b9y%28v=vs.80%29.aspx)? I guess as the BufferEntry offset is always positive so thats not a problem here, thus the warnings can be ignored right? On the other hand the conversion from unsigned int to GLsizeiptrARB will make it signed again so I'm still not 100% sure. Cheers, Oliver -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=41314#41314 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Conversion from 'GLsizeiptrARB' to 'const GLvoid *' of greater size
Hi, I have the same warning with OSG 2.9.6+ (2010/02/10) My Dev-env is: Vista 32bit VS 2005 SP1 Thank you! Cheers, Torben -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=23888#23888 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Conversion from 'GLsizeiptrARB' to 'const GLvoid *' of greater size
Hi J-S, I'm afraid I don't have any further ideas. I think we just have to return to the time/space machine that eradicates all Windows installs and replaces them with a less troublesome development platform ;-) Disabling the warning would not be idea as it could hide some genuine problems. Perhaps just disable it for the files that are causing problems? Robert. On Fri, Jan 8, 2010 at 3:32 PM, Jean-Sébastien Guay jean-sebastien.g...@cm-labs.com wrote: Hi Robert, I'm surprised that you are seeing this warning as for a 32bit build the void* should be 32bits and GLsizeiptr should be 32bit. When under a 64bit build the GLsizeiptr should be 64bit. Even if GLsizeiptr was 32bit and void* was 64bit one should still be able to cast it safely, the compiler should promote it OK. Only if we were going from 64bit to 32bit would problems likely occur, but even then in this context it's pretty unlikely that you'd be using VBO's bigger than 4GB. Yeah, seems weird to me too. Is anyone else seeing this? As for fixing the warning, your could try static_cast rather than a C cast. Using static_cast gives this: c:\dev\openscenegraph-svn\openscenegraph\include\osg\state(568) : error C2440: 'static_cast' : cannot convert from 'GLsizeiptrARB' to 'const GLvoid *' Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast Then trying reinterpret_cast (since we know the C-style cast gives the greater size warning already) gives this: c:\dev\openscenegraph-svn\openscenegraph\include\osg\state(568) : warning C4312: 'reinterpret_cast' : conversion from 'GLsizeiptrARB' to 'const GLvoid *' of greater size ARGH! Same result as the original C-style cast. And just to be completely sure the warning is totally bogus, as a little test I tried to print out sizeof(const GLvoid*) and sizeof(GLsizeiptrARB) which gives this: const GLvoid*: 4 GLsizeiptrARB: 4 Double ARGH! I'm totally out of ideas... Unless you want to disable this warning (4312)... J-S -- __ Jean-Sebastien Guay jean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Conversion from 'GLsizeiptrARB' to 'const GLvoid *' of greater size
Hi Robert, Disabling the warning would not be idea as it could hide some genuine problems. Perhaps just disable it for the files that are causing problems? So would you accept a change that pushes the warning disable state at the start of include/osg/State, disables that warning for the file, and pops the warning disable state at the end of the file? (or perhaps only in those functions would be less prone to hiding other problems) You've refused such changes in the past, but perhaps for this case it's the only way to go... J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Conversion from 'GLsizeiptrARB' to 'const GLvoid *' of greater size
Hi JS, On Mon, Jan 11, 2010 at 2:41 PM, Jean-Sébastien Guay jean-sebastien.g...@cm-labs.com wrote: So would you accept a change that pushes the warning disable state at the start of include/osg/State, disables that warning for the file, and pops the warning disable state at the end of the file? (or perhaps only in those functions would be less prone to hiding other problems) Jikes, no way. Hacks like that stays well out of general OSG headers. Disabling warnings in specific .cpp's where there are problems is acceptable. If that's not possible then placing a global disable in the CMake build or the include/osg/Export. You've refused such changes in the past, but perhaps for this case it's the only way to go... Having yet another example of how crappy compilers can be doesn't change my opinion on putting hacks into the OSG headers. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Conversion from 'GLsizeiptrARB' to 'const GLvoid *' of greater size
Hi JS, I'm surprised that you are seeing this warning as for a 32bit build the void* should be 32bits and GLsizeiptr should be 32bit. When under a 64bit build the GLsizeiptr should be 64bit. Even if GLsizeiptr was 32bit and void* was 64bit one should still be able to cast it safely, the compiler should promote it OK. Only if we were going from 64bit to 32bit would problems likely occur, but even then in this context it's pretty unlikely that you'd be using VBO's bigger than 4GB. As for fixing the warning, your could try static_cast rather than a C cast. Robert. On Thu, Jan 7, 2010 at 8:07 PM, Jean-Sébastien Guay jean-sebastien.g...@cm-labs.com wrote: Hi Robert, I've been getting this warning 7 times per compiled file for a little while: warning C4312: 'type cast' : conversion from 'GLsizeiptrARB' to 'const GLvoid *' of greater size It happens on lines like this: setVertexPointer(array-getDataSize(),array-getDataType(),0,(const GLvoid *)(vbo-getOffset(array-getBufferIndex(; The actual lines are in include/osg/state lines 578, 669, 759, 854, 921, 998 and 1163. Now, from what I can see, GLvoid is gotten from gl.h (in the Platform SDK) and evaluates to void. GLsizeiptrARB is gotten from the include/osg/BufferObject header, and evaluates to int. First of all, it's trying to convert int to const void*, am I reading that correctly? vbo-getOffset() returns GLsizeiptrARB and it's trying to cast it to const GLvoid*. Is that OK? Is there a quick way to remove this warning? I imagine in other cases, it could be a sign of 64-bit porting problems, but I'm on a 32 bit platform, so I don't see why the compiler is warning me of this. For that matter, aren't both int and void* 32 bits on 32 bit platforms? (my knowledge in this is limited, and I guess they can't be or this warning wouldn't occur...) It would be nice to be able to remove this warning. Thanks, J-S -- __ Jean-Sebastien Guay jean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Conversion from 'GLsizeiptrARB' to 'const GLvoid *' of greater size
Hi Robert, I'm surprised that you are seeing this warning as for a 32bit build the void* should be 32bits and GLsizeiptr should be 32bit. When under a 64bit build the GLsizeiptr should be 64bit. Even if GLsizeiptr was 32bit and void* was 64bit one should still be able to cast it safely, the compiler should promote it OK. Only if we were going from 64bit to 32bit would problems likely occur, but even then in this context it's pretty unlikely that you'd be using VBO's bigger than 4GB. Yeah, seems weird to me too. Is anyone else seeing this? As for fixing the warning, your could try static_cast rather than a C cast. Using static_cast gives this: c:\dev\openscenegraph-svn\openscenegraph\include\osg\state(568) : error C2440: 'static_cast' : cannot convert from 'GLsizeiptrARB' to 'const GLvoid *' Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast Then trying reinterpret_cast (since we know the C-style cast gives the greater size warning already) gives this: c:\dev\openscenegraph-svn\openscenegraph\include\osg\state(568) : warning C4312: 'reinterpret_cast' : conversion from 'GLsizeiptrARB' to 'const GLvoid *' of greater size ARGH! Same result as the original C-style cast. And just to be completely sure the warning is totally bogus, as a little test I tried to print out sizeof(const GLvoid*) and sizeof(GLsizeiptrARB) which gives this: const GLvoid*: 4 GLsizeiptrARB: 4 Double ARGH! I'm totally out of ideas... Unless you want to disable this warning (4312)... J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Conversion from 'GLsizeiptrARB' to 'const GLvoid *' of greater size
Hi Robert, I've been getting this warning 7 times per compiled file for a little while: warning C4312: 'type cast' : conversion from 'GLsizeiptrARB' to 'const GLvoid *' of greater size It happens on lines like this: setVertexPointer(array-getDataSize(),array-getDataType(),0,(const GLvoid *)(vbo-getOffset(array-getBufferIndex(; The actual lines are in include/osg/state lines 578, 669, 759, 854, 921, 998 and 1163. Now, from what I can see, GLvoid is gotten from gl.h (in the Platform SDK) and evaluates to void. GLsizeiptrARB is gotten from the include/osg/BufferObject header, and evaluates to int. First of all, it's trying to convert int to const void*, am I reading that correctly? vbo-getOffset() returns GLsizeiptrARB and it's trying to cast it to const GLvoid*. Is that OK? Is there a quick way to remove this warning? I imagine in other cases, it could be a sign of 64-bit porting problems, but I'm on a 32 bit platform, so I don't see why the compiler is warning me of this. For that matter, aren't both int and void* 32 bits on 32 bit platforms? (my knowledge in this is limited, and I guess they can't be or this warning wouldn't occur...) It would be nice to be able to remove this warning. Thanks, J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org