tags:

views:

128

answers:

3

I guess I am a bit puzzled by the syntax. What does the following mean?

typedef char *PChar;
hopeItWorks = PChar( 0x00ff0000 );
+5  A: 

It is equivalent to (PChar) 0x00ff0000 or (char *) 0x00ff0000. Syntactically think of it as invoking a one-argument constructor.

John Kugelman
+4  A: 
typedef char *PChar;

Its typedef of char* to Pchar. Instead of using char* you can define variables with Pchar.

hopeItWorks = PChar( 0x00ff0000 );

Its equivalent to ==>

 hopeItWorks = (char *)( 0x00ff0000 );
aJ
+4  A: 

SomeType(args) means explicit constructor call if SomeType is user-defined type and usual c-cast (SomeType)args if SomeType is fundamental type or a pointer.

PChar is equivalent to char * (pointer). Thus hopeItWorks = (char *)0x00ff0000;

Alexey Malistov