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


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.

double foo(double a);

int bar()
{
double b = foo(4.5);
}

thus:

@interface MyObject (PrivateMethods)
- (double) foo: (double)a
@end
@implementation MyObject
- (int) bar
{
double b = [self foo: 4.5];
}
@end


--
Adam Fedor, Digital Optics Corp. | I'm glad I hate spinach, because
http://www.doc.com | if I didn't, I'd eat it, and you
| know how I hate the stuff.


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