• 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
Obj-C language question: C function within @implementation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Obj-C language question: C function within @implementation


  • Subject: Obj-C language question: C function within @implementation
  • From: "Sean McBride" <email@hidden>
  • Date: Thu, 3 Jul 2003 09:44:02 -0400
  • Organization: Matrox Electronic Systems Ltd.

I'm no Obj-C expert, but I found some suspicious code that my Obj-C
newbie coworker wrote. I've reduced it to this example:

#import <Cocoa/Cocoa.h>

int main(int argc, const char *argv[])
{
return NSApplicationMain(argc, argv);
}

@interface MyClass : NSObject
{
IBOutlet NSProgressIndicator* progress;
}
@end

@implementation MyClass

void Function (void* thing)
{
MyClass* uc = (MyClass*)thing;
[uc->progress stopAnimation:uc];
}

@end

Notice that there is a C function within the @implementation block. This
compiles without error/warning with gcc and CodeWarrior. If I move this
outside the @implementation block CW gives an error and gcc gives a
warning (progress is protected), both of which make more sense IMHO.
Should this code compile as it is above? Seems to me progress is
protected no matter where Function() is.

Thanks!

--
____________________________________________________________
Sean McBride, B. Eng email@hidden
Mac Software Designer +1-514-822-6000
Matrox Electronic Systems Ltd. Montrial, Quibec, Canada
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Obj-C language question: C function within @implementation
      • From: Dietmar Planitzer <email@hidden>
    • Re: Obj-C language question: C function within @implementation
      • From: Jeff Harrell <email@hidden>
  • Prev by Date: Re: [OT] Re: EOF undead?
  • Next by Date: Re: [OT] Immortal Property List Editor
  • Previous by thread: Re: Can't create new document
  • Next by thread: Re: Obj-C language question: C function within @implementation
  • Index(es):
    • Date
    • Thread