If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
typecast internals
Hi,
I would like to know more about casts.What exactly happens when casts are applied to a variable.I know that if an object of type int is applied an cast of float the result would be of type float. 1) What i would like to know is the about the internals when a cast is applied ? Say we have int i = 3; double j; j = (double) i; What happens in the above statement ? Can someone explain me at bit level or a considerable explantion ? 2) Also i would like to know what happens say i = (int)j; Again an explanation at the bit level would be very helpful. If we have 3) float f = 4.3; int i; i = (int) f; What happens here ? How does the truncation take place ? 4) Is it similar to how int got promoted to double in the question 2. 5) How are side effects defined ? When do i say typecasting is an side effect ? 6) Is truncation a side effect of type casting or not ? Nik - |
#2
|
|||
|
|||
You have posted to the wrong newsgroup. This group is about computer
hardware, not programming language constructs. Please check your newsserver for an appropriate forum to discuss this topic. -- My words are my own. They represent no other; they belong to no other. Don't read anything into them or you may be required to compensate me for violation of copyright. (I do not speak for my employer.) |
Thread Tools | |
Display Modes | |
|
|