• 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
No warnings when ObjC subclass method signatures differ
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

No warnings when ObjC subclass method signatures differ


  • Subject: No warnings when ObjC subclass method signatures differ
  • From: glenn andreas <email@hidden>
  • Date: Mon, 30 Jul 2007 15:25:36 -0500

Consider the following snippet (gcc v 4.0.1):

@interface Foo : NSObject
- (void) doSomething: (float) x;
@end
@implementation Foo
- (void) doSomething: (float) x
{
}
@end

@interface Bar : Foo
@end
@implementation Bar
- (void) doSomething: (int) x
{
}
@end

If Foo's "doSomething" were implemented with (int) x, there would be a warning:

test.mm:7: warning: conflicting types for ‘-(void)doSomething:(float)x’
test.mm:4: warning: previous declaration of ‘-(void)doSomething:(int)x’


However, no such warning exists for Foo's subclass Bar's conflicting implementation - as a result:

[[Bar alloc] doSomething: 0.5];

will result in (at best) garbage results.

Shouldn't this at least merit a warning?

rdar://5370783


Glenn Andreas                      email@hidden 
 <http://www.gandreas.com/> wicked fun!
quadrium | flame : flame fractals & strange attractors : build, mutate, evolve, animate



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: No warnings when ObjC subclass method signatures differ
      • From: "Kyle Sluder" <email@hidden>
  • Prev by Date: Re: Using Xcode debugger without Xcode project
  • Next by Date: Re: No warnings when ObjC subclass method signatures differ
  • Previous by thread: Re: Setting SVN repository
  • Next by thread: Re: No warnings when ObjC subclass method signatures differ
  • Index(es):
    • Date
    • Thread