| 1 |
// Type Casting, main.cpp |
| 2 |
|
| 3 |
#include <limits> |
| 4 |
#include <cstddef> |
| 5 |
|
| 6 |
namespace ns { |
| 7 |
|
| 8 |
typedef int myint; |
| 9 |
|
| 10 |
class Foo {}; |
| 11 |
|
| 12 |
} // namespace ns |
| 13 |
|
| 14 |
int main(int argc, char **argv) { |
| 15 |
int a = 1; |
| 16 |
int *ap = &a; |
| 17 |
void *vp = &a; |
| 18 |
int arr[2] = {1, 2}; |
| 19 |
|
| 20 |
int na = -1; |
| 21 |
float f = 1.1; |
| 22 |
|
| 23 |
typedef int myint; |
| 24 |
std::nullptr_t std_nullptr_t = nullptr; |
| 25 |
bool found_it = false; |
| 26 |
if (std_nullptr_t) { |
| 27 |
found_it = true; |
| 28 |
} else { |
| 29 |
found_it = (bool)0; |
| 30 |
} |
| 31 |
|
| 32 |
myint myint_ = 1; |
| 33 |
ns::myint ns_myint_ = 2; |
| 34 |
ns::Foo ns_foo_; |
| 35 |
ns::Foo *ns_foo_ptr_ = &ns_foo_; |
| 36 |
|
| 37 |
float finf = std::numeric_limits<float>::infinity(); |
| 38 |
float fnan = std::numeric_limits<float>::quiet_NaN(); |
| 39 |
float fsnan = std::numeric_limits<float>::signaling_NaN(); |
| 40 |
float fmax = std::numeric_limits<float>::max(); |
| 41 |
float fdenorm = std::numeric_limits<float>::denorm_min(); |
| 42 |
|
| 43 |
int arr_1d[] = {1, 2, 3, 4}; |
| 44 |
int arr_2d[2][3] = {{1, 2, 3}, {4, 5, 6}}; |
| 45 |
|
| 46 |
return 0; // Set a breakpoint here |
| 47 |
} |