I was reading through the tutorial on this site and came to the typecasting tutorial, and i was just wondering what anyone would ever need typecasting for
I was reading through the tutorial on this site and came to the typecasting tutorial, and i was just wondering what anyone would ever need typecasting for
²
You can see all the ASCII characters by typecasting and then press ALT and the number on the number pad and get the desired effect
and other things, typecasting is to be avoided
Do you just like to talk out your ass or what? Nearly ever post of yours I've come across is full of gems like these.Originally Posted by mrafcho001
Typecasting is used to convert one type of an object to another. For example, if you have a floating point number, and you wan't to treat it as an integer, you may type cast it. The language itself has automatic type promotion for the basic types: char to short int to int to long int, float to double, and the like. Typecasting is used for when there are no such conversions and you need one.
Quzah.
Hope is the first step on the road to disappointment.
whats your problem?
Typecasting can be used for the reason i pointed above... and it is to be avoided, there is like nothing wrong with what i said..
You're an idiot. Typecasting is not "to be avoided". How would you assign a floating point number to an integer? Without a cast? Why? Why wouldn't you typecast it? What in your great wisdom makes the cast something to avoid there?
What you mentioned above, typing with alt + number pad, has nothing to do with typecasting. Typecasting isn't something you punch in on your keyboard, unless you count the actual typing of the word "static_cast", or one of the others, or wrapping parenthesis around the keyword "int" or what not.
In short, you're an idiot. The faster people figure this out, the less they'll be confused by your 'insight'.
Quzah.
Hope is the first step on the road to disappointment.
What a ..........Code:for(int i = 0; i < 255; i++) { cout << i << " " << char(i) << endl; } //displays the number and the coresponding character //Pressing ALT and the number youll get hte character for example: //ALT 253 = ² //So STFU //idk if you read the book The C++ programming language - Bjarne Stroustrup, // but he clearly states that typecasting is to be avoied float afl = 2.48; int aInt = afl; //The Compiler may complain about it but //works perfectly and will give the exact same result as would: float afl = 2.48; int aInt = int (afl);
This has absolutely nothing to do with typecasting. Getting input from the user is not typecasting.Originally Posted by mrafcho001
Page 14 - Notes to the readerOriginally Posted by mrafcho001
Try to avoid void *, pointer arithmetic, unions and casts except deep within the implementation of some function or class. In most cases a cast is an indication of design error.
Is that what you were looking for? Good for him. That doesn't make you any less of an idiot. As a matter of fact...
If he agrees with you, that it's better to just let your compiler spit warnings at you, and to do nothing about them, when you can get rid of them with a cast, then he's an idiot too.Originally Posted by mrafcho001
Quzah.
Hope is the first step on the road to disappointment.
You know i can stay here all day and argue with your, but im gonna be the man and walk away from this .........
Peace out dude, and just a side note, if you have problems with what others post just say what you think/know is right, you don't have to be a .......... about everything.