[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re[2]: class initialization problem ?
From: |
Manuel Guesdon |
Subject: |
Re[2]: class initialization problem ? |
Date: |
Fri, 22 Aug 2003 10:02:55 +0200 (CEST) |
Hi David,
On Thu, 21 Aug 2003 18:54:30 +0200 David Ayers <d.ayers@inode.at> wrote:
>| Hi Manual,
>|
>| the unintilized pointer is actually the class name as a c string. From:
>| init.c
[...]
>| static Class class_superclass_of_class (Class class)
>| ...
>|
>| Maybe you could rely on GSObjCRuntime functions (GSObjCSuper) that try
>| handle these oddities.
Thank you for the explanation.
At the begining my problem was with GSObjCIsKindOf wich wasn't returning YES
when I didn't Log the class before (more
precisely now with your help, when the class has not received a message before).
GSObjCIsKindOf use class_get_super_class and that's why I've got the problem.
So I think there's a bug in GSObjCIsKindOf as it doesn't return the good result
under this case.
Using GSObjCSuper doesn't seems t to be a solution as it call
class_get_super_class
Is there a way to know if a class is initialized and force initialization in
GSObjCSuper and GSObjCIsKindOf if it
is not ?
Manuel
>|
>| Cheers,
>| David
>|
>|
>| Manuel Guesdon wrote:
>|
>| >Hi,
>| >
>| >I've found a very very stange thing:
>| >
>| >I wanted to find if class aClass inherit from another class bClass.
>| >When NSLog-ing class, this works, without it doesn't !
>| >
>| >Here are some traces:
>| >aClass=0x4156e320
> (aClass address)
>| >
>| >class_get_super_class(aClass)=0x4156d782
>(aClass superclass adress)
>| >class_get_super_class(class_get_super_class(aClass))=(null) (aClass
>superclass superclass adress. It
>| shouldn't
>| >be null !!!!)
>| >
>| >aClass=MyClassName
> (result of
>| NSLog(@"aClass=%@",aClass))
>| >
>| >aClass=0x4156e320
> (aClass address; same as 1st
>| time)
>| >class_get_super_class(aClass)=0x41487400
>(aClass superclass adress. It has changed
>| !!)
>| >class_get_super_class(class_get_super_class(aClass))=0x406fcf40 (aClass
>superclass superclass adress. It's now
>| correct !)!)
>| >
>| >
>| >Any idea ?
>| >
>| >Manuels
>| >
>| >
>|
>|
>|
--
______________________________________________________________________
Manuel Guesdon - ORANGE CONCEPT <mguesdon@orange-concept.com>
14 rue Jean-Baptiste Clement - 93200 Saint-Denis - France
Tel: +33 1 4940 0997 - Fax: +33 1 4940 0998