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

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

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

  5. casting - How do I convert between numeric types safely and ...

    Feb 2, 2015 · For example, casting using 4294967295us as u32 works and the Rust 0.12 reference docs on type casting say A numeric value can be cast to any numeric type. A raw …

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

  7. casting - Explanation of ClassCastException in Java - Stack Overflow

    May 25, 2009 · 6 Do you understand the concept of casting? Casting is the process of type conversion, which is in Java very common because its a statically typed language. Some …

  8. c# - Why should casting be avoided? - Stack Overflow

    Aug 1, 2013 · Bad is a relative term. Avoiding casting is a best-practice, but sometimes a programmer has gotta do what a programmer has got to do. (especially if you writing a java …

  9. Casting a number to a string in TypeScript - Stack Overflow

    Casting a number to a string in TypeScript Asked 10 years, 1 month ago Modified 1 year, 10 months ago Viewed 643k times

  10. Casting variables in Java - Stack Overflow

    Mar 13, 2011 · Regarding use for casting, you still see the need for it in some libraries. Pre Java-5 it was used heavily in collections and various other classes, since all collections worked on …