Should I cast variables that use a typdef'd type?

Posted by mesorismo on Stack Overflow See other posts from Stack Overflow or by mesorismo
Published on 2010-06-16T00:51:52Z Indexed on 2010/06/16 1:02 UTC
Read the original article Hit count: 234

Filed under:
|

If I have something like:

typedef int MyType;

is it good practice to cast the operands of an operation if I do something like this:

int x = 5;
int y = 6;

MyType a = (MyType)(x + y);

I know that I don't need to do that but wondering if it's better for intent/documentation/readability concerns.

© Stack Overflow or respective owner

Related posts about casting

Related posts about typedef