• 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: Porting 'operator' to Obj-C
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Porting 'operator' to Obj-C


  • Subject: Re: Porting 'operator' to Obj-C
  • From: Jonathan Prescott <email@hidden>
  • Date: Fri, 26 Sep 2008 11:47:43 -0400

This is C++, not C. You need to be compiling this as Objective-C++, not Objective-C. Easiest way is to change the extension of the file from ".m" to ".mm" if you are using Xcode.
As an aside, you do not need the "typedef" in C++. Simply declaring the struct (or class) is enough to declare the type.


Jonathan

On Sep 26, 2008, at 11:40 AM, Alex Finkel wrote:

Thanks, but can you point me in the right direction. The code bellow does
not build. Am I doing something wrong with the struct?


typedef struct dbnames {



   short  Handle;

short Version;

int   Size;

int        NumEntries;

   char       Name[ 32 ];

    dbnames()

:Handle(-1),

Version ( 0),

Size (0),

NumEntries ( 0),

{

Name[0] = '\0';

}

    dbnames( struct dbnames const& other )

:Handle( other.Handle ),

Version( other.Version ),

Size( other.Size ),

NumEntries( other.NumEntries )

   {

       for ( unsigned int i = 0; i < sizeof( Name ); i ++ )

{

           Name[i] = other.Name[i];

}

   }



};
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Porting 'operator' to Obj-C (From: "Alex Finkel" <email@hidden>)
 >Re: Porting 'operator' to Obj-C (From: Robert Claeson <email@hidden>)
 >Re: Porting 'operator' to Obj-C (From: "Alex Finkel" <email@hidden>)

  • Prev by Date: NSLevelIndicator - setEnabled not respected
  • Next by Date: Re: Use other key than "tab" to cycle through text fields
  • Previous by thread: Re: Porting 'operator' to Obj-C
  • Next by thread: NSLevelIndicator - setEnabled not respected
  • Index(es):
    • Date
    • Thread