From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8405 invoked by alias); 24 Nov 2006 18:45:38 -0000 Received: (qmail 8391 invoked by uid 22791); 24 Nov 2006 18:45:36 -0000 X-Spam-Check-By: sourceware.org Received: from exprod6og56.obsmtp.com (HELO exprod6og56.obsmtp.com) (64.18.1.208) by sourceware.org (qpsmtpd/0.31) with SMTP; Fri, 24 Nov 2006 18:45:23 +0000 Received: from source ([192.150.11.134]) by exprod6ob56.postini.com ([64.18.5.12]) with SMTP; Fri, 24 Nov 2006 10:45:21 PST Received: from inner-relay-1.corp.adobe.com ([153.32.1.51]) by outbound-smtp-1.corp.adobe.com (8.12.10/8.12.10) with ESMTP id kAOIgavV011800; Fri, 24 Nov 2006 10:42:36 -0800 (PST) Received: from fe2.corp.adobe.com (fe2.corp.adobe.com [10.8.192.72]) by inner-relay-1.corp.adobe.com (8.12.10/8.12.10) with ESMTP id kAOIjKPF021686; Fri, 24 Nov 2006 10:45:20 -0800 (PST) Received: from namailgen.corp.adobe.com ([10.8.192.91]) by fe2.corp.adobe.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 24 Nov 2006 10:45:20 -0800 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: Problem with the string Date: Fri, 24 Nov 2006 18:45:00 -0000 Message-ID: References: <9ee2fe770611240316p30920d39nb1d28dde53936ea0@mail.gmail.com> From: "John \(Eljay\) Love-Jensen" To: "kanishk rastogi" , "Andrew Haley" Cc: X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2006-11/txt/msg00293.txt.bz2 Hi kanishk, > i want to put string "kanishk" into writeable memory (or other than read = execute segment). Is there a way for doing this without making any change i= n calling sequence (for example it may be regulated by some switch in gcc) = or there is no provision in C99 standard for it. The 'string "kanishk"' is a read-only non-modifiable C-string literal const= ant. Are you programming in C or C++? Then a read-only non-modifiable C-string = literal constant is read-only and non-modifiable. There is no provision in= C or C++ to make a read-only non-modifiable C-string literal constant into= a non-read-only modifiable C-string literal mutable. If you want a modifiable string, you have to declare it that way, for examp= le: char kanishk[] =3D "kanishk"; MyFuncThatModifiesTheCharPtrData(kanishk); (Hopefully the MyFuncThatModifiesTheCharPtrData doesn't overrun the buffer.) HTH, --Eljay