This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to check that selectors exist


On Tuesday, August 6, 2002, at 07:28 AM, Adam Fedor wrote:

Nicola Pero wrote:
4. it's completely inconsistent with how checks for functions and
variables and methods and everything are handled/done, since normally when
checking the compiler never 'looks ahead', while for selectors it would
do; this might look like an improvement at a first glance, but it actually
confused me a lot the first time I tried to use it, since the golden
standard rule that 'everything must be declared before being used' is no
longer valid, but a more complex, selector-specific, rule is used.
This is the main point for me, since I think selectors should be handled like functions in this respect, and it's just good practice (sometimes necessary!) to declare a function before you use it.
Do you do much Objective C programming? Good practice in
Objective C is not the same as good practice in C++.

Two observations.
(1) I assert that very few organizations have as much experience
with large bodies of Objective C code than Apple applications
groups. I claim that they have had more opportunity to learn
what good Objective C practice is than most other groups out
there, and that their opinions about good practice should be
taken seriously.
(2) Devang's original patch is one that will catch probable errors.
Nicola's proposed change will catch errors and will also catch
violations of one particular idea of good practice. I believe a
closely targeted warning about probable errors is a good idea,
and that we should not entangle it with the good-practice
warning. If we want a forward-declaration warning, it should be
separate. (I can certainly see that some Objective C programmers
may have reasons for using forward declarations consistently,
and that they'd find it useful if the compiler helped them with
their stylistic choices.)

(Note, by the way, that I don't do much Objective C programming.
My understanding of good Objective C style is mostly taken from
my coworkers.)

--Matt


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]