... | ... | @@ -28,12 +28,12 @@ |
|
|
```
|
|
|
|
|
|
3. <strong>Avoid C-style casting:</strong> use C++11 style casting: ```static_cast, dynamic_cast (classes), reinterpret_cast```.
|
|
|
* Don't
|
|
|
* _Don't_
|
|
|
```cpp
|
|
|
int foo = ( int ) bar;
|
|
|
char* buffer = (char*) data;
|
|
|
```
|
|
|
* Do
|
|
|
* _Do_
|
|
|
```cpp
|
|
|
int foo = static_cast<int>( foo );
|
|
|
char* buffer = reinterpret_cast<char*>( data );
|
... | ... | |