[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFI]: getting objc to grok attributes ??
From: |
Kaveh R. Ghazi |
Subject: |
Re: [RFI]: getting objc to grok attributes ?? |
Date: |
Mon, 17 Jun 2002 10:33:13 -0400 (EDT) |
> From: Nicola Pero <address@hidden>
Nicola - Thanks for all of your comments/feedback!
> [...]
> The reason is that, while in C you define a function and normally the
> function has a single implementation associated with it (so, if an
> argument is unused, it's suspicious that there might be a mismatch between
> the declaration and the implementation, and it's a good idea to warn), in
> ObjC is very common to define a method in a place and have many different
> implementations of the method in many different classes. For example -
Yes, C++ (whose syntax I do know) is much the same. In C++, one can
omit function/method parameter names when they are unused and g++
avoids warning in these cases. E.g.
> int foo (int a, int, char *)
> { return a; }
Here g++ will not warn about the unused 2nd and 3rd arguments. I
don't know objc syntax to suggest a similar mechanism. (It may not be
possible, if you can omit the type there's no argument placeholder?)
> Depending on the semantics of __attribute__ ((__unused__)) [does it mark
> the argument as being possibly unused in that method implementation, or is
> it a system-wide declaration that in all implementations of methods with
> that name/signature the argument could be unused ?],
In frontends where its currently implemented, attributes on parameters
are specific to the exact function or method where one uses it. I
would expect that if we extend objc to allow it we would follow this
convention.
> So, maybe (from an ObjC user point of view) we should better disable the
> warnings for unused method arguments, unless some -Wxxx option is included
> to cause them (my bet is nobody will ever want to use that option, but
> anyway).
If that's the consensus among objc developers fine, but I'm not sure I
like it and its beyond what I would be interested in implementing.
Its too blunt, I prefer a clean way of specifying which unused
identifiers are ignorable and warn about anything else.
Can you perhaps suggest something based on the C++ example I gave?
--Kaveh
--
Kaveh R. Ghazi Director of Systems Architecture
address@hidden Qwest Solutions