Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualBaneTrapper

Posted 25 December 2012 - 02:17 PM

You can also use a proper static_cast:
int a = 100;float b = static_cast<float>(a); // int to float
Or:
float b = 100.0f;int a = static_cast<int>(b); // float to int
I am quite unsure, how or what i did different then you, or what you meant by proper usage of static cast.

And if you are referring to "Khatharr" post, then you should quote it, also i don't see anything "Inappropriate" about him mentioning / using c style cast to int.

I used it like this
float posX;float posY;int main(){    setTextPosition(static_cast <int> (posX) ,static_cast <int> (posY) ) ;    return 0;}
EDIT::
I noticed what did you mean...
The code was tipped in the post, and i made a mistake i shall fix that.
Also the whole post messes up the code section when its edited sorry.

#3BaneTrapper

Posted 25 December 2012 - 02:16 PM

You can also use a proper static_cast:
int a = 100;float b = static_cast<float>(a); // int to float
Or:
float b = 100.0f;int a = static_cast<int>(b); // float to int
I am quite unsure, how or what i did different then you, or what you meant by proper usage of static cast.

And if you are referring to "Khatharr" post, then you should quote it, also i don't see anything "Inappropriate" about him mentioning / using c style cast to int.

I used it like this
float posX;float posY;int main(){    setTextPosition(static_cast <int> (posX) ,static_cast <int> (posY) ) ;    return 0;}

EDIT::
I noticed what did you mean...
The code was tipped in the post, and i made a mistake i shall fix that.

#2BaneTrapper

Posted 25 December 2012 - 02:16 PM

You can also use a proper static_cast:
int a = 100;float b = static_cast<float>(a); // int to float
Or:
float b = 100.0f;int a = static_cast<int>(b); // float to int
I am quite unsure, how or what i did different then you, or what you meant by proper usage of static cast.

And if you are referring to "Khatharr" post, then you should quote it, also i don't see anything "Inappropriate" about him mentioning / using c style cast to int.

I used it like this
float posX;float posY;int main(){    setTextPosition(static_cast <int> (posX) ,static_cast <int> (posY) ) ;    return 0;}

EDIT::
I noticed what did you mean...
The code was tipped in the post, and i made a mistake i shall fix that.

#1BaneTrapper

Posted 25 December 2012 - 02:13 PM

You can also use a proper static_cast:

int a = 100;
float b = static_cast<float>(a); // int to float

Or:

float b = 100.0f;
int a = static_cast<int>(b); // float to int

I am quite unsure, how or what i did different then you, or what you meant by proper usage of static cast.

 

And if you are referring to "Khatharr" post, then you should quote it, also i don't see anything "Inappropriate" about him mentioning / using c style cast to int.

 

I used it like this

float posX;
float posY;

int main()
{
    setTextPosition(
static_cast <int> (posX) ,
static_cast <int> (posY) ) ;
    return 0;
}

PARTNERS