From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9950 invoked by alias); 24 Nov 2006 10:37:59 -0000 Received: (qmail 9821 invoked by uid 22791); 24 Nov 2006 10:37:58 -0000 X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 24 Nov 2006 10:37:52 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id kAOAbpTF012228 for ; Fri, 24 Nov 2006 05:37:51 -0500 Received: from zebedee.littlepinkcloud.COM (vpn-14-69.rdu.redhat.com [10.11.14.69]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id kAOAbmpU020806; Fri, 24 Nov 2006 05:37:48 -0500 Received: from littlepinkcloud.COM (localhost.localdomain [127.0.0.1]) by zebedee.littlepinkcloud.COM (8.13.6/8.13.5) with ESMTP id kAOAbkEf019862; Fri, 24 Nov 2006 10:37:46 GMT Received: (from aph@localhost) by littlepinkcloud.COM (8.13.6/8.13.5/Submit) id kAOAbjed019859; Fri, 24 Nov 2006 10:37:45 GMT MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17766.52089.676318.750296@zebedee.pink> Date: Fri, 24 Nov 2006 10:37:00 -0000 From: Andrew Haley To: "kanishk rastogi" Cc: gcc-help@gcc.gnu.org Subject: Re: Problem with the string In-Reply-To: <9ee2fe770611240230i4cc7a449ra280da3dfacd3674@mail.gmail.com> References: <9ee2fe770611240126t47803b82gc733ae0e7d61b746@mail.gmail.com> <17766.49617.952075.116206@zebedee.pink> <9ee2fe770611240214vc69d03eg7493ab05b913077a@mail.gmail.com> <17766.50893.613365.742603@zebedee.pink> <9ee2fe770611240221g1ba97a3axd591b89267b960b1@mail.gmail.com> <17766.51276.179245.1953@zebedee.pink> <9ee2fe770611240230i4cc7a449ra280da3dfacd3674@mail.gmail.com> X-Mailer: VM 7.19 under Emacs 21.4.1 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/msg00280.txt.bz2 kanishk rastogi writes: > On 11/24/06, Andrew Haley wrote: > > kanishk rastogi writes: > > > if i call a func like: > > > > > > func("kanishk"); > > > the string "kanishk" will be defined in readonly segment or in read - > > > write segment ? > > > if they will be in read-only segment i dont want that.... > > > how can this be done > > > > Dammit, how many times do I have to repeat this? > > > > You just gotta declare them right. Like this: > > > > char s[] = "kanishk"; > > func(s); > thanks for the advice andrew > and sorry for the annoyance > but the fact is I cant change the code because its more than 8000 > lines so i am asking for a feature in gcc which i would have missed Your code is wrong. "How do I get gcc to compile this code with these bugs?" is not a sensible question. Fix the bugs! 8000 lines is a small piece of code, and you should be able to fix it in less than an hour or so. Andrew. > > thanks in advance > > > > > On 11/24/06, Andrew Haley wrote: > > > > kanishk rastogi writes: > > > > > On 11/24/06, Andrew Haley wrote: > > > > > > kanishk rastogi writes: > > > > > > > hi all, > > > > > > > when we compile our c programs the strings which we use get defined in > > > > > > > read only memory. > > > > > > > how can i ask the gcc compiler to declare them in read-write section. > > > > > > > > > > > > You just gotta declare them right. Like this: > > > > > > > > > > > > char s[] = "This is a string!"; > > > > > what abt the strings passed to functions? > > > > > i dont want to have them in readonly menory > > > > > > > > They won't be in read-only memory: as I said, you just gotta declare > > > > them right. > > > > > > > > Andrew. > > > > > > > > > > > > > -- > > > Everybody is made for some purpose. Find yours. > > > > > -- > Everybody is made for some purpose. Find yours.