• 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: Bug in GCC 3.1?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug in GCC 3.1?


  • Subject: Re: Bug in GCC 3.1?
  • From: Thomas Lachand-Robert <email@hidden>
  • Date: Tue, 7 May 2002 10:27:03 +0200

Le mardi 7 mai 2002, ` 12:35 , email@hidden a icrit :

|That's what I meant. This doesn't explain why [self bar:(id)t] doesn't
|work, since NOW the object type is unspecified as you say.

But "bar:" requires an object that *is* specified, at least to the extent of implementing the NSMutableCopying protocol.


I think you didn't understand my point. It is not directly related to protocols, but to cast. An explicit cast to id, or use of an id variable, normally removes any compiler warning like in these examples:
-foo1:(NSString*)s;
-foo2:(NSObject*)o;
-foo3:(NSObject<NSCopying>*)o;

id t; [self foo1:t]; [self foo2:t]; [self foo3:t]; // no complaint, because t is id
NSProxy *a; [self foo1:(id)a]; [self foo2:(id)a]; [self foo3:(id)a]; // no complaint, because of the cast

(Note that in the last case, a is not even an NSObject.)

Now I still find strange to have the compiler complaining for that:
-foo4:(id<NSCopying>)o;

id<NSMutableCopying> t; [self foo4:(id)t]; // compiler warning

Apparently Nat! agrees with me. Are some other people on the list have an opinion on that?

Thomas Lachand-Robert
********************** email@hidden
<< Et le chemin est long du projet ` la chose. >> Molihre, Tartuffe.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Bug in GCC 3.1?
      • From: email@hidden
References: 
 >Re: Bug in GCC 3.1? (From: email@hidden)

  • Prev by Date: Re: [sort of OT] PackageMaker help
  • Next by Date: Color in a round button ?
  • Previous by thread: Re: Bug in GCC 3.1?
  • Next by thread: Re: Bug in GCC 3.1?
  • Index(es):
    • Date
    • Thread