• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Q's about Obj-C
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Re: Q's about Obj-C (From: Andreas Monitzer <email@hidden>)

  • Prev by Date: Re: Q's about Obj-C
  • Next by Date: Re: Q's about Obj-C
  • Previous by thread: Re: Q's about Obj-C
  • Next by thread: Re: Q's about Obj-C
  • Index(es):
    • Date
    • Thread