• 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: (no subject)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (no subject)


  • Subject: Re: (no subject)
  • From: Stefan Fisk <email@hidden>
  • Date: Mon, 21 Feb 2005 12:33:59 +0100

I'm sorry, but i get the same error even when i leave the consts out completely.
It clearly seems to be something you're just not allowed to do, but i can't make out why, it just looks like an array of pointers to me..

2005-02-21 kl. 12.04 skrev Darkshadow:

On Feb 21, 2005, at 4:36 AM, Stefan Fisk wrote:

Hi!

I'm trying to simplify my -setDelegate: a bit, and therefore want to put all my notifications in a c-style array.
But, could anyone explain why the code snippet below gives me the following error:
<x-tad-smaller>
TNKCoreTask.m:18: error: (near initialization for `delegationNotifications[0]')
TNKCoreTask.m:18: error: initializer element is not constant
TNKCoreTask.m:19: error: (near initialization for `delegationNotifications[1]')
TNKCoreTask.m:19: error: initializer element is not constant
TNKCoreTask.m:21: error: (near initialization for `delegationNotifications[2]')
TNKCoreTask.m:21: error: initializer element is not constant
</x-tad-smaller>

I've tried googling for a couple of hours, but i found nothing that felt relevant.
My reason for doing it this way is that i want to standardize my -setDelegate: methods as far as possible, so that there's only place in the code to edit when adding notifications.

CODE:

NSString * const TNKCoreTaskDidLaunchNotification = @"coreTaskDidLaunch:";
NSString * const TNKCoreTaskDidWriteToStdOutNotification = @"coreTaskDidWriteToStdOut:";
NSString * const TNKCoreTaskDidTerminateNotification = @"coreTaskDidTerminate:";


Try const NSString *

NSString *delegationNotifications[] = {
TNKCoreTaskDidLaunchNotification,
TNKCoreTaskDidWriteToStdOutNotification,
TNKCoreTaskDidTerminateNotification,
nil
};


Thanks on forehand

Stefan Fisk
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: (no subject)
      • From: Douglas Norton <email@hidden>
    • Re: (no subject)
      • From: "Geert B. Clemmensen" <email@hidden>
References: 
 >(no subject) (From: Stefan Fisk <email@hidden>)
 >Re: (no subject) (From: Darkshadow <email@hidden>)

  • Prev by Date: Re: (no subject)
  • Next by Date: Re: (no subject)
  • Previous by thread: Re: (no subject)
  • Next by thread: Re: (no subject)
  • Index(es):
    • Date
    • Thread