• 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: Problem with defining an opaque structure
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with defining an opaque structure


  • Subject: Re: Problem with defining an opaque structure
  • From: Ondra Cada <email@hidden>
  • Date: Mon, 19 Aug 2002 16:35:55 +0200

On Monday, August 19, 2002, at 03:41 , Pierre-Olivier Latour wrote:

I'm trying to define an opaque structure:

struct OpaqueStructure;
typedef struct OpaqueStructure;
typedef OpaqueStructure* OpaqueStructurePtr;

typedef struct {
OpaqueStructurePtr stuff;
} OtherStructure;
...
I don't get what I'm doing wrong since as far as I remember this code works
with C/C++ compiler.

With C++ it might, with C it should not. Try

typedef struct OpaqueStructure OpaqueStructure;
typedef OpaqueStructure* OpaqueStructurePtr;

(beware, not tested, might overlooked something. The gist is that in C a structure name without "struct" can't be used as a type, and that your first and second lines are both meaningless.)
---
Ondra Hada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
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.
References: 
 >Problem with defining an opaque structure (From: Pierre-Olivier Latour <email@hidden>)

  • Prev by Date: Re: NSWindow's title
  • Next by Date: Re: Fwd: NSArray and Objects
  • Previous by thread: Re: Problem with defining an opaque structure
  • Next by thread: Re: Problem with defining an opaque structure
  • Index(es):
    • Date
    • Thread