¡@

Home 

c++ Programming Glossary: casting

In C++, why use static_cast<int>(x) instead of (int)x?

http://stackoverflow.com/questions/103512/in-c-why-use-static-castintx-instead-of-intx

should be preferred to C style or simple function style casting. Is this true Why c casting share improve this question .. or simple function style casting. Is this true Why c casting share improve this question The main reason is that classic..

pthread Function from a Class

http://stackoverflow.com/questions/1151582/pthread-function-from-a-class

of this to use so if you try to get around the compiler by casting the method to a function pointer of the appropriate type you'll..

Regular cast vs. static_cast vs. dynamic_cast

http://stackoverflow.com/questions/28002/regular-cast-vs-static-cast-vs-dynamic-cast

MyClass ptr MyClass m dynamic_cast MyClass ptr c pointers casting c faq share improve this question static_cast static_cast..

Should I use static_cast or reinterpret_cast when casting a void* to whatever

http://stackoverflow.com/questions/310451/should-i-use-static-cast-or-reinterpret-cast-when-casting-a-void-to-whatever

I use static_cast or reinterpret_cast when casting a void to whatever Both static_cast and reinterpret_cast seem.. static_cast and reinterpret_cast seem to work fine for casting void to another pointer type. Is there a good reason to favor..

C++ cast syntax styles

http://stackoverflow.com/questions/32168/c-cast-syntax-styles

but their effect should be the same right . If you're just casting between the built in numeric types I find C style cast syntax.. constructor syntax. What do you think c coding style casting share improve this question It's best practice never to..

When should static_cast, dynamic_cast and reinterpret_cast be used?

http://stackoverflow.com/questions/332030/when-should-static-cast-dynamic-cast-and-reinterpret-cast-be-used

I am familiar with the risks and benefits of pointer casting as well as the evils of using C style casts. What I am looking.. one decide which one to use in a specific case c pointers casting c faq share improve this question static_cast is the first.. through inheritance hierarchies. It is unnecessary when casting upwards towards a base class but when casting downwards it can..

Polymorphism in c++

http://stackoverflow.com/questions/5854581/polymorphism-in-c

polymorphism for builtin types Standard conversions and casting coercion are discussed later for completeness as they're commonly.. overloading for builtin types Standard conversions casting coercion implicit constructors they all contribute subtle support..

Dealing with accuracy problems in floating-point numbers

http://stackoverflow.com/questions/590822/dealing-with-accuracy-problems-in-floating-point-numbers

h 1 integer int columns int mw h 11 p h 11 p g 1 Prior to casting to an integer type the result of the columns calculation is..

What does “(void) new” mean in C++?

http://stackoverflow.com/questions/1029743/what-does-void-new-mean-in-c

of the void c void share improve this question Casting an expression to void basically tells the compiler to ignore..

Casting between void * and a pointer to member function

http://stackoverflow.com/questions/1307278/casting-between-void-and-a-pointer-to-member-function

between void and a pointer to member function I'm currently..

Efficient unsigned-to-signed cast avoiding implementation-defined behavior

http://stackoverflow.com/questions/13150449/efficient-unsigned-to-signed-cast-avoiding-implementation-defined-behavior

through INT_MAX std numeric_limits int is_modulo is true Casting unsigned n to int preserves the value for 0 n 32767 and yields.. is at least INT_MAX 1 . Obviously x is at most UINT_MAX . Casting a negative number to unsigned is the same as adding UINT_MAX..

Priority when choosing overloaded template functions in C++

http://stackoverflow.com/questions/1332678/priority-when-choosing-overloaded-template-functions-in-c

submitted as the parameter is derived from Base or not. So Casting to Base is not an option. In fact the idea behind the whole..

Why does int*[] decay into int** but not int[][]?

http://stackoverflow.com/questions/14183546/why-does-int-decay-into-int-but-not-int

this because it knows the size of the inner dimension s . Casting to an int 4 retains this information it's a pointer to length..

Casting between primitive type pointers

http://stackoverflow.com/questions/14773127/casting-between-primitive-type-pointers

between primitive type pointers Is the following well defined..

C++ format macro / inline ostringstream

http://stackoverflow.com/questions/303562/c-format-macro-inline-ostringstream

Should I use static_cast or reinterpret_cast when casting a void* to whatever

http://stackoverflow.com/questions/310451/should-i-use-static-cast-or-reinterpret-cast-when-casting-a-void-to-whatever

this question You should not use reinterpret_cast . Casting some pointer from void is not allowed using reinterpret_cast..

How do C/C++ compilers handle type casting between types with different value ranges?

http://stackoverflow.com/questions/340413/how-do-c-c-compilers-handle-type-casting-between-types-with-different-value-ra

object which is a temporary returned by the cast operator. Casting to a reference type however will not create a new object. The.. casting from a possibly more narrow type to a wider type. Casting from char to int short to int float to double are all promotions...

Why does C++ require a cast for malloc() but C doesn't?

http://stackoverflow.com/questions/3477741/why-does-c-require-a-cast-for-malloc-but-c-doesnt

converted to any other object pointer type. C does not. Casting the result of malloc in C will supress a useful diagnostic if..

C++: Is it safe to cast pointer to int and later back to pointer again?

http://stackoverflow.com/questions/3567905/c-is-it-safe-to-cast-pointer-to-int-and-later-back-to-pointer-again

64 a pointer is 64 bit long but int is only 32 bit long. Casting a pointer to int and back again makes the upper 32 bit of the..

What are all the common undefined behaviour that a C++ programmer should know about? [closed]

http://stackoverflow.com/questions/367633/what-are-all-the-common-undefined-behaviour-that-a-c-programmer-should-know-ab

e.g. int64_t i 1 i 72 is undefined Types Cast and Const Casting a numeric value into a value that can't be represented by the..

C++ Subclassing, Inheritance and Casting

http://stackoverflow.com/questions/4941906/c-subclassing-inheritance-and-casting

Subclassing Inheritance and Casting This specific conundrum is hard for me to explain so I'll try..

Integer division algorithm

http://stackoverflow.com/questions/5097383/integer-division-algorithm

it wasn't being taught anymore and filled us in on it. Casting out 999's in base 1000 won't work as a general division algorithm...

Why does this double to int conversion not work?

http://stackoverflow.com/questions/5852815/why-does-this-double-to-int-conversion-not-work

ever so slightly smaller than 410 i.e. 409.99... . Casting to int discards the fractional part so you get 409. If you want..

Does casting to an int after std::floor guarantee the right result?

http://stackoverflow.com/questions/605533/does-casting-to-an-int-after-stdfloor-guarantee-the-right-result

64 bit integers which is why std floor returns a double . Casting to int should be fine so long as it's within the appropriate..

Casting a large number type to a smaller type

http://stackoverflow.com/questions/6752567/casting-a-large-number-type-to-a-smaller-type

a large number type to a smaller type I've had a good look..