• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Q's about Obj-C
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Q's about Obj-C


  • Subject: Re: Q's about Obj-C
  • From: Ondra Cada <email@hidden>
  • Date: Tue, 16 Oct 2001 12:01:48 +0100

Bradley,

>>>>>> Smith, Bradley (SB) wrote at Tue, 16 Oct 2001 09:16:39 +0100:
SB> If you want to be able to call a function outside of that translation
SB> unit then you do indeed need to prototype (declare) your function in your
SB> header file.

That's not true.

SB> Think of functions declared in the header as public and ones
SB> not declared in the header as private.

Don't think so, since it's wrong.

SB> So, my question is does the same / similar rule apply to Obj-C messages /
SB> methods?

It does not, since there is _no such rule_ in plain C:

178 /tmp\> cat > q1.c
int fubar(int i) { return i*i; }
179 /tmp\> cat > q2.c
void main() {
int i;
for (i=0;i<5;i++) printf("%d^2=%d\n",i,fubar(i));
}
180 /tmp\> cc q1.c q2.c && ./a.out
0^2=0
1^2=1
2^2=4
3^2=9
4^2=16
181 /tmp\>

SB> >(i) for a moment, forget ObjC completely. We are in plain C,
SB> >and we speak
SB> >functions. Now,
SB> >
SB> >- you don't have to declare a function;
SB> >- function name is sufficient so as the proper function is called;
SB> >- you have to beware though that the argument types and
SB> >return values are correct.
SB> >
SB> >This is something you should know very well, in case you are
SB> >an experienced
SB> >C programmer. Right?
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
2K Development: email@hidden http://www.2kdevelopment.cz
private email@hidden http://www.ocs.cz/oc


References: 
 >RE: Q's about Obj-C (From: "Smith, Bradley" <email@hidden>)

  • Prev by Date: Re: Client/Server followup
  • Next by Date: Re: A Stupid Question
  • Previous by thread: RE: Q's about Obj-C
  • Next by thread: Re: Q's about Obj-C
  • Index(es):
    • Date
    • Thread