• 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: [OT] A bit confused on pointers...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [OT] A bit confused on pointers...


  • Subject: Re: [OT] A bit confused on pointers...
  • From: Scott Ribe <email@hidden>
  • Date: Fri, 30 Dec 2005 12:40:12 -0700
  • Thread-topic: [OT] A bit confused on pointers...

> When I try to go farther by having a function return a function:
>
> static int (*f3)()(); //{ return f1; }

It's a gnarly precedence/parsing problem, and this is the solution:

static int f1() { return 0; }
static int (*(f3)())() { return f1; }

I'm not defending the rules, just pointing out that it can be done ;-) In
your typedef, you were saying "foo_t is a pointer to a function..." In this
statement you do not want to say "f3 is a pointer to a function..." you want
to say "f3 is a function returning a pointer to an unnamed function..."

I'm going to stop now, because when I read that it starts to sound rather
scarily as though I know what I'm talking about. And I guess I do at least a
little, but I'm pushing it here...

--
Scott Ribe
email@hidden
http://www.killerbytes.com/
(303) 665-7007 voice


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: [OT] A bit confused on pointers...
  • Next by Date: Re: Document-based app
  • Previous by thread: Re: [OT] A bit confused on pointers...
  • Next by thread: Re: [OT] A bit confused on pointers...
  • Index(es):
    • Date
    • Thread