Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Const correctness



On Fri, 10 Jun 2005 13:04:47 +0200, Andreas Grosam <email@hidden>
wrote:
> On 09.06.2005, at 13:49, Clark Cox wrote:
>> On 6/9/05, Markian Hlynka <email@hidden> wrote:
> In order to be platform independend, i would recommend to declare
> string literal const:
> const char* cs = "I'm const";
> then, you get compiler errors when you attempt to modify the characters.

IIRC "const char* cs" declares a constant pointer to a character string
where "const char *cs" declares a pointer to a constant character string.

In the first case you can modify the string but not the pointer; in the
second you can modify the pointer but not the string that it points to.

I'm sure someone (the syntax police) will let us know if I'm smoking crack.
;-)

-- 
Enjoy,
George Warner,
Schizophrenic Optimization Scientist
Apple Developer Technical Support (DTS)


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/xcode-users/email@hidden

This email sent to email@hidden



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

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.