Changes
Page history
Updated C Interoperability and Type Casting (markdown)
authored
May 04, 2017
by
williamfgc
Show whitespace changes
Inline
Side-by-side
C-Interoperability-and-Type-Casting.md
View page @
6fcc7a49
...
...
@@ -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
);
...
...
...
...