Re: Q's about Obj-C
Re: Q's about Obj-C
- Subject: Re: Q's about Obj-C
- From: Ondra Cada <email@hidden>
- Date: Mon, 15 Oct 2001 18:35:45 +0100
Andreas,
>
>>>>> Andreas Monitzer (AM) wrote at Mon, 15 Oct 2001 18:03:04 +0200:
AM> >3. Dunno, but be interested to find out
AM>
AM> It's ok, but be prepared for a compiler warning.
And potential crash or strange behaviour if you decide to ignore that warning!
In situation like
@interface A...
-foo:(float)f;
@end
@interface B...
-foo:(int)i;
@end
id o;
[o foo:1];
you have EXACTLY the same potential for nasty problems as if you do in plain C
void foo(float f) { ... };
// in a different source file:
void foo(int i);
foo(1);
Therefore, I repeat: it's NOT ok, you have to cast to tell compiler how the
arguments should be stored (and/or how the return value should be
interpreted).
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
2K Development: email@hidden
http://www.2kdevelopment.cz
private email@hidden
http://www.ocs.cz/oc