Click here to Skip to main content
15,902,492 members
Home / Discussions / C#
   

C#

 
GeneralCheck if TCP/IP partner disconnected... Pin
Norman-Timo24-Aug-04 23:18
Norman-Timo24-Aug-04 23:18 
GeneralRe: Check if TCP/IP partner disconnected... Pin
leppie25-Aug-04 1:45
leppie25-Aug-04 1:45 
GeneralRe: Check if TCP/IP partner disconnected... Pin
Norman-Timo25-Aug-04 3:16
Norman-Timo25-Aug-04 3:16 
GeneralRe: Check if TCP/IP partner disconnected... Pin
Sebastian Schneider25-Aug-04 4:54
Sebastian Schneider25-Aug-04 4:54 
GeneralRe: Check if TCP/IP partner disconnected... Pin
Norman-Timo25-Aug-04 20:54
Norman-Timo25-Aug-04 20:54 
QuestionCan anybody explain me how does casting work *internally*? Pin
Salil Khedkar24-Aug-04 20:40
Salil Khedkar24-Aug-04 20:40 
AnswerRe: Can anybody explain me how does casting work *internally*? Pin
leppie24-Aug-04 21:06
leppie24-Aug-04 21:06 
AnswerRe: Can anybody explain me how does casting work *internally*? Pin
Sebastian Schneider25-Aug-04 5:12
Sebastian Schneider25-Aug-04 5:12 
The compiler knows how he stores every variable.

The programmer of that compiler just parses for an explicit cast (like (int)myvar) and then says: well, I have to shove these first bits into a new integer-style, then turn them around and here we go....

Casting is all about conversion between different bit arrangements.

Everything is stored as bits in your memory. By declaring variables or designing your class, you also did a description of how these objects or whatever are stored in memory.

Of course, for SOME types, there is no logical conversion. It DOES NOT MAKE SENSE to cast a string into an integer or the other way round.

In these cases, you need to PARSE your stuff, which takes much longer (microcode-wise) than simply rearraning your bits in a given pattern.

Really, just think about it. Everything is bits. You have an signed integer and want to cast it into an unsigned long. What do you have to do?
basically, substract one, then xor with all ones (like 01010011 ^ 11111111)
you then have the "normal" representation of your number, now just remove the sign and...

And so on.

Computers work by rules. If you know these rules, you just have to write them down into a program.

Still, writing a compiler is something I wish I never have to do.

Cheers
Sebs
GeneralRe: Can anybody explain me how does casting work *internally*? Pin
Salil Khedkar25-Aug-04 20:45
Salil Khedkar25-Aug-04 20:45 
QuestionAre there dynamic array librarys available in C#? Pin
gotton24-Aug-04 20:10
gotton24-Aug-04 20:10 
AnswerRe: Are there dynamic array librarys available in C#? Pin
leppie24-Aug-04 21:04
leppie24-Aug-04 21:04 
AnswerRe: Are there dynamic array librarys available in C#? Pin
Norman-Timo25-Aug-04 3:21
Norman-Timo25-Aug-04 3:21 
GeneralDrawing Pin
Member 1697724-Aug-04 18:29
Member 1697724-Aug-04 18:29 
GeneralRe: Drawing Pin
sreejith ss nair24-Aug-04 18:56
sreejith ss nair24-Aug-04 18:56 
QuestionFirst time using Windows Forms -- Components not appearing? Pin
Waverian24-Aug-04 17:23
Waverian24-Aug-04 17:23 
AnswerRe: First time using Windows Forms -- Components not appearing? Pin
sreejith ss nair24-Aug-04 18:53
sreejith ss nair24-Aug-04 18:53 
QuestionSingleton ? Pin
Christian Graus24-Aug-04 16:06
protectorChristian Graus24-Aug-04 16:06 
AnswerRe: Singleton ? Pin
Heath Stewart24-Aug-04 16:11
protectorHeath Stewart24-Aug-04 16:11 
QuestionHashtable error: "Object reference not set to an instance of ans object."! ??? Pin
gman4424-Aug-04 15:04
gman4424-Aug-04 15:04 
AnswerRe: Hashtable error: "Object reference not set to an instance of ans object."! ??? Pin
Charlie Williams24-Aug-04 15:33
Charlie Williams24-Aug-04 15:33 
GeneralRe: Hashtable error: "Object reference not set to an instance of ans object."! ??? Pin
Heath Stewart24-Aug-04 15:53
protectorHeath Stewart24-Aug-04 15:53 
GeneralRe: Hashtable error: "Object reference not set to an instance of ans object."! ??? Pin
Charlie Williams24-Aug-04 16:35
Charlie Williams24-Aug-04 16:35 
AnswerRe: Hashtable error: "Object reference not set to an instance of ans object."! ??? Pin
Heath Stewart24-Aug-04 15:51
protectorHeath Stewart24-Aug-04 15:51 
AnswerRe: Hashtable error: "Object reference not set to an instance of ans object."! ??? Pin
Jay Shankar24-Aug-04 16:09
Jay Shankar24-Aug-04 16:09 
GeneralC# CreateGraphics() Pin
Moon Boy24-Aug-04 13:01
Moon Boy24-Aug-04 13:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.