beautypg.com

9 pointers to members, 10 parentheses, 11 arrays – Renesas Emulator Debugger M16C PC4701 User Manual

Page 270: 12 casting to basic types

background image


10.1.9 Pointers to Members

Pointers to members using the ".*" or "->*" operator can be refered only in the forms of variable
name .* member name or variable name ->* member name.
Example:

class T {
public:
int member;
};
class T t_cls;
class T *pt_cls = &t_cls;

int T::*mp = &T::member;


In this case, t_cls.*mp and tp_cls->*mp can correctly reference the variable of pointer-to-member type.

Note

Note that the expression *mp cannot considered as the variable of pointer-to-member type.

10.1.10 Parentheses

Use the '(' and ')' to specify priority of calculation within an expression.

10.1.11 Arrays

You can use the ' [ ' and ' ] ' to specify the elements of an array. You can code arrays as follows:
"variable_name [ (element_No or variable) ] ", "variable_name [ (element_No or variable) ]
[ (element_No or variable) ] ", etc.

10.1.12 Casting to Basic Types

You can cast to C basic types char, short, int, and long, and cast to the pointer types to these basic
types. When casting to a pointer type, you can also use pointers to pointers and pointers to pointers to
pointers, etc.
Note that if signed or unsigned is not specified, the default values are as follows:

Basic type

Default

char

unsigned

short

signed

int

signed

long

signed

Notes

Of the basic types of C++, casts to bool type, wchar_t type, and floating-point type (float or
double) cannot be used.

Casts to register variables cannot be used.

256