Casting is a process where an object type is explicitly converted into another type if the conversion is allowed.
-1
votes
1answer
21 views
return makes pointer from integer without a cast - but types are okay?
Just some code. In one file and its header:
// header:
extern char * thessc_config_member_get_config_key(struct config_member_t *m);
// implementation:
inline char * ...
1
vote
1answer
29 views
Go: cast slice of primitive to a slice of its alias
I'm trying to do something along these lines:
package main ...
0
votes
4answers
77 views
C pointer and type conversation
Need some help with type conversation with string pointers in C. I have a function that gets the the *argv from main loop to pass command-line parameters to it. Since the parameters are fixed, I am ...
1
vote
3answers
44 views
scala.Some cannot be cast to java.lang.String
In this application, I'm getting this error:
scala.Some cannot be cast to java.lang.String
When trying this:
x.email.asInstanceOf[String]
x.email is an Option[String]
Edit: I understand that ...
1
vote
3answers
62 views
Why cant i cast an Action<Int32> to Action<Object>?
I have several places where i have Action<Int32>, Action<Boolean>, Action<SomeClassName> being used, but when it comes to passing the action as an argument in a class method, i ...
0
votes
0answers
40 views
C casting sockaddr into sockaddr_in
for some reasons my pointer needs to point sockaddr not sockaddr_in , how can i cast these two structures in order to use sin_family , sin_pot and sin_addr with the sockaddr pointer ?
here 's my code
...
0
votes
0answers
67 views
How to convert an int pointer to the reference of an int array
I just come across the following problem:
void func( int (&arr)[3] ){...}
int main( int argc, char* argv[] )
{
int* a = new int[3];
a[0]=0, a[1]=1, a[2]=2;
f(a);// how to convert a ...
0
votes
1answer
12 views
Ray Casting a transparent PNG in Java with LWJGL
Im making a game and id like to implement raycasting for the hero's laser (and other stuff in the future), i have my sprites in a sprite sheet which i bind in the beggining and access when i draw ...
2
votes
5answers
89 views
How to make int from char[4]? (in C)
I have char a[4] and in it:
a[0] = 0x76
a[1] = 0x58
a[2] = 0x02
a[3] = 0x00
And I want print it as int, can you tell me how to do that?
1
vote
4answers
36 views
SQL Cast/Convert Issue
This is more like a help from experts than a question. I need to declare a variable called BillingYear which I can assign it to a year. The problem is:
I do not know which data type it should be! I ...
1
vote
5answers
57 views
Forced necessity of dynamic_cast operator in C++
dynamic_cast is generally used when we have a base class pointer and want to downcast it to a derived class. For instance,
class A
{
public:
virtual void foo();
};
class B : public A
{
...
5
votes
1answer
54 views
Why does implicit casting work while reflection casting throws exception?
Suppose there is the following code:
@SuppressWarnings("unchecked")
public static <T> T implicitCaster(Class<T> cls, Object o) {
return (T) o;
}
public static <T> T ...
2
votes
4answers
33 views
Why is this boolean casting not working as expected?
I've just answered this question but I don't understand why it works the way it does.
Basically the problem can be simplified to this:
var b = new Boolean(false);
console.info(b == false); // Prints ...
0
votes
0answers
13 views
Checkbox bind does not work for insert radgrid template
Hallo I have a problem.
I made a telerik radgrid. I have a FormTemplate where i have a custom form to insert new items.
The item has a couple of properties. On of them is a string and one of them is ...
1
vote
0answers
13 views
PHP: locale-dependent float to string cast
I'm sitting on a machine with en_US locale and this piece of PHP code
setlocale(LC_ALL,'de_DE.utf8');
var_dump((string)1.234);
returns
string(5) "1.234"
whereas on my colleague's machine which ...