[OGo-GNUstep-Port] gcc 3 warnings
Helge Hess
gnustep-port@opengroupware.org
Sat, 19 Jul 2003 01:27:23 +0200
On Freitag, 18. Juli 2003, at 23:19 Uhr, Filip Van Raemdonck wrote:
> Gcc 3 is a bit more picky about some things, and some of the
> complaints it
> has go like this:
I know, we already fixed a lot of that stuff, but not everything :-(
Actually it is not picky, but rather follows the spec (AFAIK Nicola has
fixed the compiler which previously did not consider ObjC typing at
all).
> SoHTTPAuthenticator.m: In function `-[SoHTTPAuthenticator authRealm]':
> SoHTTPAuthenticator.m:45: warning: multiple declarations for method
> `name'
...
> Now there are depending on the situation two or one solutions to get
> rid
> of these, AFAICT.
>
> The first is, where messages are sent which are defined in OGo specific
> classes, not to use too generic names for these methods so that they
> don't
> clash with others.
Well:
a) this would be completely against the Smalltalk idea of ObjC, names
should be the same if they do similiar things (like -name)
b) it would be an unacceptable change to source code potentially
breaking a lot of things
> The second is typecasting the recievers to the class from which the
> desired method is.
This is the way to go, even being ugly, I admit :-(
> For new methods, IMHO it's a good idea to use the first solution as it
> has
> the added benefit of (usually) making it easier to go find out where a
> specific method comes from when reading some code.
No, it's absolutely no good idea and is against all OO programming
principles. Either you disable those warnings (because they are just
warnings!) or you cast if you want to use the type system of C. We'll
prefer the latter.
> However, it's a lot of work to change that through out an entire source
> tree, and it's error prone.
Exactly. Not an option.
> So, would it be ok to typecast receivers as per the second solution to
> fix these warnings? Any objections?
Yes, this is the way to go. It also makes the actual type of the
receiver explicit which is not necessarily a bad thing.
Thanks for your work!
Helge
--
OpenGroupware.org - http://www.opengroupware.org/