Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#ActualHodgman

Posted 04 December 2012 - 07:08 AM

In order to call your function, you're constructing a string object from a const char[] object. The compiler doesn't know whether that constructor/destructor causes any side-effects, so it can't remove that bit of code in order to be sure it hasn't changed the meaning of your program.

Change your setVertexShaderConstant function to take a const char*, or alternatively, convert the literal text into string objects in advance (instead of every call), and the useless code should go away.

Personally, I don't use a string class at all, but that's probably controversial advice.

#4Hodgman

Posted 04 December 2012 - 07:07 AM

In order to call your function, you're constructing a string object from a const char[] object. The compiler doesn't know whether that constructor/destructor causes any side-effects, so it can't remove that bit of code in order to be sure it hasn't changed the meaning of your program.

Change your setVertexShaderConstant function to take a const char*, or alternatively, convert the literal text into string objects in advance (instead of every call), and the useless code should go away.

#3Hodgman

Posted 04 December 2012 - 07:00 AM

In order to call your function, you're constructing a string object from a const char[] object. The compiler has no way of knowing whether that constructor/destructor causes any side-effects, so it can't remove it.

Change your setVertexShaderConstant function to take a const char*, or alternatively, convert the literal text into string objects in advance (instead of every call), and the useless code should go away.

#2Hodgman

Posted 04 December 2012 - 06:59 AM

In order to call your function, you're constructing a string object from a const char[] object. The compiler has no way of knowing whether that constructor/destructor cases any side-effects, so it can't remove it.

Change your setVertexShaderConstant function to take a const char*, or alternatively, convert the literal text into string objects in advance (instead of every call), and the useless code should go away.

#1Hodgman

Posted 04 December 2012 - 06:58 AM

In order to call your function, you're constructing a string object from a const char[] object. The compiler has no way of knowing whether that constructor/destructor cases any side-effects, so it can't remove it.
Change your setVertexShaderConstant function to take a const char* and the useless code should go away.

PARTNERS