About 50 results
Open links in new tab
  1. 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 …

  2. 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. …

  3. How do I cast int to enum in C#? - Stack Overflow

    Casting is sometimes confusing in C# if you don't know the details... Anyhow, because int != short, it will throw (unboxing fails). If you do object o = (short)5;, it will work, because then the …

  4. 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 …

  5. 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?

  6. 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<> (), …

  7. casting - Int to Char in C# - Stack Overflow

    Nov 14, 2008 · What is the best way to convert an Int value to the corresponding Char in Utf16, given that the Int is in the range of valid values?

  8. 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 ...

  9. Should I cast the result of malloc (in C)? - Stack Overflow

    Although malloc without casting is preferred method and most experienced programmers choose it, you should use whichever you like having aware of the issues. i.e: If you need to compile C …

  10. Why is casting a const reference directly to a mutable reference ...

    Nov 24, 2018 · The superficial answer to the question "why?" is that these simply are the rules of as expressions in Rust. Quoting from the Nomicon: Casting is not transitive, that is, even if e …