About 50 results
Open links in new tab
  1. casting - Converting double to integer in Java - Stack Overflow

    Jun 24, 2011 · is there a possibility that casting a double created via Math.round() will still result in a truncated down number No, round() will always round your double to the correct value, and …

  2. Regular cast vs. static_cast vs. dynamic_cast - Stack Overflow

    Aug 26, 2008 · Static cast is also used to cast pointers to related types, for example casting void* to the appropriate type. dynamic_cast Dynamic cast is used to convert pointers and references …

  3. c++ - When should static_cast, dynamic_cast, const_cast, and ...

    The C-style casts can do virtually all types of casting from normally safe casts done by static_cast<> () and dynamic_cast<> () to potentially dangerous casts like const_cast<> (), …

  4. Casting vs using the 'as' keyword in the CLR - Stack Overflow

    Casting can be used on any compatible types, it can be overloaded, and it will throw an exception if the operation fails. The choice of which to use depends on the circumstances.

  5. casting - C convert floating point to int - Stack Overflow

    Jul 13, 2014 · I don't understand what you mean by “convert an int to a binary number”— int already is binary… Or do you mean to convert it to a string of the binary representation, e.g. …

  6. casting - How to cast or convert an unsigned int to int in C?

    Feb 26, 2011 · The real question is what you want to do when/if the value in the unsigned int it out of the range that can be represented by a signed int. If it's in range, just assign it and you're …

  7. Best practice in C++ for casting between number types

    May 28, 2016 · What is the best practice for casting between the different number types? Types float, double, int are the ones I use the most in C++. An example of the options where f is a …

  8. Why use static_cast<T>(x) instead of (T)x? - Stack Overflow

    Sep 19, 2008 · The C++ casting operators are intended to expose these issues in the code by providing compile-time or run-time errors when possible. So, for strict "value casting" you can …

  9. casting - Downcasting in Java - Stack Overflow

    Dec 19, 2008 · Upcasting is allowed in Java, however downcasting gives a compile error. The compile error can be removed by adding a cast but would anyway break at the runtime. In ...

  10. casting - How to cast int to enum in C++? - Stack Overflow

    May 28, 2017 · How do I cast an int to an enum in C++? For example: enum Test { A, B }; int a = 1; How do I convert a to type Test::A?