• 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: Mutable copy of a character set is different?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mutable copy of a character set is different?


  • Subject: Re: Mutable copy of a character set is different?
  • From: Thomas Lachand-Robert <email@hidden>
  • Date: Sun, 7 Apr 2002 20:25:16 +0200

Hi all,

I used to believe that [something mutableCopy] gives an object functionally equivalent to the original, except for the possibility to change it. But it is not true for NSCharacterSet, as you can see by running this small program:

#import <Foundation/Foundation.h>

int main () {
NSMutableCharacterSet* man = [[NSCharacterSet alphanumericCharacterSet] mutableCopy];
unichar c = 31;
while (++c < 32767) {
int b1 = [man characterIsMember:c],
b2 = [[NSCharacterSet alphanumericCharacterSet] characterIsMember:c];
if (b1 != b2)
printf("char %c (code %d) is in man:%i in alphanumeric:%i\n", c, (int) c, b1, b2);
}
return 0;
}

The output will be as follows:

char ^ (code 94) is in man:0 in alphanumeric:1
char ` (code 96) is in man:0 in alphanumeric:1
char B. (code 168) is in man:0 in alphanumeric:1
char C (code 175) is in man:0 in alphanumeric:1
char B% (code 180) is in man:0 in alphanumeric:1
char b (code 184) is in man:0 in alphanumeric:1

(probably the last four will be garbaged be the mail system, but you can see the decimal codes).

There is no problem if I change "mutableCopy" to "copy" in the code. I suspect a strong bug in Apple's code, but if anyone as another explanation,
I'm interested!

Thomas Lachand-Robert
********************** email@hidden
<< Et le chemin est long du projet C la chose. >> MoliC(re, Tartuffe.
_______________________________________________
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.

  • Prev by Date: A Cocoa application to access an Openbase db
  • Next by Date: Changing fonts in an NSTableView
  • Previous by thread: Re: A Cocoa application to access an Openbase db
  • Next by thread: Changing fonts in an NSTableView
  • Index(es):
    • Date
    • Thread