casting int to char using C++ style casting

You should use static_cast<char>(i) to cast the integer i to char. reinterpret_cast should almost never be used, unless you want to cast one type into a fundamentally different type. Also reinterpret_cast is machine dependent so safely using it requires complete understanding of the types as well as how the compiler implements the cast. For more information about C++ casting see: When should static_cast, … Read more

How to convert string to boolean php

Strings always evaluate to boolean true unless they have a value that’s considered “empty” by PHP (taken from the documentation for empty): “” (an empty string); “0” (0 as a string) If you need to set a boolean based on the text value of a string, then you’ll need to check for the presence or otherwise of that value. … Read more

How to cast ArrayList<> from List<>

When you do the second one, you’re making a new arraylist, you’re not trying to pretend the other list is an arraylist. I mean, what if the original list is implemented as a linkedlist, or some custom list? You won’t know. The second approach is preferred if you really need to make an arraylist from … Read more

How should I cast in VB.NET?

Those are all slightly different, and generally have an acceptable usage. var.ToString() is going to give you the string representation of an object, regardless of what type it is. Use this if var is not a string already. CStr(var) is the VB string cast operator. I’m not a VB guy, so I would suggest avoiding it, but it’s not … Read more

No function matches the given name and argument types

Your function has a couple of smallint parameters.But in the call, you are using numeric literals that are presumed to be type integer. A string literal or string constant (‘123’) is not typed immediately. It remains type “unknown” until assigned or cast explicitly. However, a numeric literal or numeric constant is typed immediately. The manual: A numeric constant that contains neither a decimal … Read more