About 50 results
Open links in new tab
  1. c# - Why should casting be avoided? - Stack Overflow

    Aug 1, 2013 · I generally avoid casting types as much as possible since I am under the impression that it's poor coding practice and may incur a performance penalty. But if someone asked me to explain …

  2. 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 then, it …

  3. 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 at run-time, …

  4. Casting to string versus calling ToString - Stack Overflow

    Oct 14, 2009 · (string)obj casts obj into a string. obj must already be a string for this to succeed. obj.ToString() gets a string representation of obj by calling the ToString() method. Which is obj itself …

  5. c++ - What does casting to `void` really do? - Stack Overflow

    Dec 15, 2015 · Casting a variable expression to void to suppress this warning has become an idiom in the C and later C++ community instead because the result cannot be used in any way (other than …

  6. Casting from 'System.Int16' to type 'System.Int32'

    May 28, 2024 · I'm willing to bet it has nothing to do with casting and everything to do with boxing. While an implicit cast from int16 to int32 is available, you can't unbox an int16 to int32

  7. Casting to void* and Back to Original_Data_Type*

    Jul 29, 2025 · Casting to void* removes all type safety. If you use reinterpret_cast or static_cast to cast from a pointer type to void* and back to the same pointer type, you are actually guaranteed by the …

  8. 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<> (), where const modifier can …

  9. Casting a double as an int, does it round or just strip digits?

    Nov 8, 2012 · Doing some calculations with doubles which then need to be cast to an int. So i have a quick question, when casting a double say 7.5 to an int, it will return 7. Is this a product of rounding …

  10. sql - Casting varchar as date - Stack Overflow

    Casting varchar as date Asked 9 years, 11 months ago Modified 9 years, 11 months ago Viewed 31k times