• 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: Using C?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using C?


  • Subject: Re: Using C?
  • From: Bob Savage <email@hidden>
  • Date: Fri, 15 Jun 2001 23:31:34 -0700

> The only real problem I've experienced with my C method is that it seems
> unable to call methods of access variables in the same object. Calling
> stuff like [self: doSomething] within the C method results in the
> warning "self undeclared." Is it not possible to mix up C and Objective-C
> like this? Also, for example, any variables declared in the header file for
> the object are also inaccessable in the C function/method.

This has little to do with Obj-C. "self" is a variable that is out of scope.
The relation to Obj-C is that the Obj-C runtime provides "self" as a hidden
argument to method calls. If you use it in a C function, it is your
responsibility to define it and assign it a value. I wouldn't recommend it,
though. It would just get confusing. Instead try definig the function to
include a descriptive variable of type id (or more precisely typed if you so
choose). E.g.

void superFunc( id orbulator, int timing) {
[orbulator initiateOrbingSequenceAfter: timing];
}

best of luck,

Bob


  • Prev by Date: Re: Cocoa/EOF for non-enterprise apps
  • Next by Date: Subclassing NSString
  • Previous by thread: Re: Using C?
  • Next by thread: Re: Cocoa/EOF for non-enterprise apps Re: proof of cocoa
  • Index(es):
    • Date
    • Thread