Re: No warnings when ObjC subclass method signatures differ
Re: No warnings when ObjC subclass method signatures differ
- Subject: Re: No warnings when ObjC subclass method signatures differ
- From: "Kyle Sluder" <email@hidden>
- Date: Mon, 30 Jul 2007 16:32:48 -0400
Did you use -Wall? Or perhaps the gcc maintainers decided that this
was a lint issue.
--Kyle Sluder
On 7/30/07, glenn andreas <email@hidden> wrote:
> 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
>
_______________________________________________
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