• 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
mixing c with obj c
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

mixing c with obj c


  • Subject: mixing c with obj c
  • From: Phillip Morelock <email@hidden>
  • Date: Fri, 12 Apr 2002 16:48:52 -0700

Hi,
Excuse my newbie-ness at the fu of mixing "straight" c with obj-c...

I am trying to declare this in an object interface as an instance variable.
what am i doing wrong?

@interface MyThingy : NSObject
{
id foo[];
}
....
@end

yes i know, NSMutableArray or etc...but I am implementing some data
structures using a mix of straight / obj C...have had no problems declaring
structs and declaring pointers to them in class interfaces, etc., but this
id[] thing is throwing me for a loop.

Neither
id foo[];
nor
id[] foo;
seems to work.

The thing is -- i don't want to declare a size (id foo[10]) because it's an
array-based implementation of a data structure...i need to be able to double
the array, obviously i just want a pointer.

Am i just out of luck or do i need to do something a little different? like
void pointer arithmetic and etc? I am keeping track of some "size" figures
and such, so I *think* i could still be safe while relying on pointer
arithmetic.

t.i.a. if anyone even understands my garbled question ;)
fillup
_______________________________________________
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: mixing c with obj c
      • From: Ondra Cada <email@hidden>
  • Prev by Date: Re: Icon for prefPane bundle?
  • Next by Date: Re: mixing c with obj c
  • Previous by thread: Re: Newbie question: floating windows/panels
  • Next by thread: Re: mixing c with obj c
  • Index(es):
    • Date
    • Thread