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 @
e9b32152
...
...
@@ -18,8 +18,8 @@
std::cout << "2^5 = " << powerOfTwo << "\n";
```
2.
<strong>
Exception for using C headers/functions:
</strong>
*
C++ API is deprecated or not fully supported libraries ( _e.g._ MPI, CUDA_C, PETSc )
2.
<strong>
Exception
s
for using C headers/functions:
</strong>
*
C++ API is deprecated or not fully supported
in
libraries ( _e.g._ MPI, CUDA_C, PETSc )
*
No POSIX equivalent in C++: _e.g._
```unistd.h, shmem.h, sys/ipc.h```
*
Language Interoperability through C
```
...
...
@@ -27,7 +27,7 @@
C++ --> C --> JNI --> Java --> JNI --> C --> C++
```
3.
<strong>
Avoid C-style casting:
</strong>
use C++11 style casting:
```static_cast, dynamic_cast, reinterpret_cast``.
3.
<strong>
Avoid C-style casting:
</strong>
use C++11 style casting:
```static_cast, dynamic_cast
(classes)
, reinterpret_cast``.
* Don't
```
cpp
int foo = ( int ) bar;
...
...
...
...