[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    casting an 'int' to a class
From:       Ellis Whitehead <kde () ellisw ! net>
Date:       2002-01-22 0:54:42
[Download RAW message or body]

Would the following cast from an int to a struct cause problems on any 
systems?

struct A {
	int a;
	int x();
};

int foo() {
	int b = 0;
	return ((A*)(&b))->x();
}

I have a couple classes related to kdelibs/kdecore/kkey* that contain only a 
single 'int' of data.  I would like to keep them private and put 'int's in 
the containing class definition.

Thanks,
Ellis

 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic