casts

How does function-style cast syntax work

I guess I am a bit puzzled by the syntax. What does the following mean? typedef char *PChar; hopeItWorks = PChar( 0x00ff0000 ); ...

What is wrong with this C cast

I came across this in an IRC channel yesterday and didn't understand why it was bad behavior. #include <stdio.h> int main(void) { char x[sizeof(int)] = { '\0' }; int *y = (int *) x; printf("%d\n", *y); } Is there any loss of data or anything? can anyone give me any docs to explain further about what it does wrong? thanks! ...

What are the rules for multiple casts in C#?

Hello, I have this code snippet and I would like to know why is the output as written in comment below: interface I { void m1(); void m2(); void m3(); } class A : I { public void m1() { Console.WriteLine("A.m1()"); } public virtual void m2() { Console.WriteLine("A.m2()"); } public virtual ...