Home > C++, VC++ > Charizing operator (Microsoft specific)!

Charizing operator (Microsoft specific)!

You’ve heard of stringizing pre-processor operators, ever heard of charizing operators?

Very similar to stringizing operators, except that it puts single quotes around it’s arguments, that’s why it’s called the charizing operator!

For stringizing we use “#” operator but for charizing we use “#@”.

Here is an e.g.

From MSDN:

#define MakeChar( ch ) #@ch

Calling this macro now!

const char ch = MakeChar( x );
printf( "After charizing: %c", ch );

After charizing: x

MakeChar expands to ‘x’ which is of char type, hence the name charizing!

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: