Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: const StringPtr != ConstStringPtr
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: const StringPtr != ConstStringPtr



On Jan 10, 2006, at 13:23, David Fang wrote:

If you expand the typedefs, you'll see why they are not the same:

StringPtr is a pointer to char

ConstStringPtr is a pointer to const char,
	the pointer itself is mutable, but the pointee (char) is
	read-only.

const StringPtr is a const pointer to char,
	that is, the pointer is const (immutable) while the pointee (char)
	remains modifiable.

const ConstStringPtr is a const pointer to const char

Oh duh. Even with the thousands of times I've typed const in various places in function declarations and everywhere else, I looked at the typedef and totally interpreted it wrong. Thanks for the jump start.


So I guess this means that CW is wrong in letting this pass when the "strings are read-only" setting is on.

Steve Mills
Drummer, Mac geek
http://sjmills5.home.mchsi.com/


_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Re: const StringPtr != ConstStringPtr (From: David Fang <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.