public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Haley <aph@redhat.com>
To: "kanishk rastogi" <kanishk.85@gmail.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: Problem with the string
Date: Fri, 24 Nov 2006 13:33:00 -0000	[thread overview]
Message-ID: <17766.62615.8515.653880@zebedee.pink> (raw)
In-Reply-To: <9ee2fe770611240340sb6907f9k9e21d0814d71475b@mail.gmail.com>

kanishk rastogi writes:
 > On 11/24/06, Andrew Haley <aph@redhat.com> wrote:
 > > kanishk rastogi writes:
 > >  > On 11/24/06, Andrew Haley <aph@redhat.com> wrote:
 > >  > > kanishk rastogi writes:
 > >  > >  > On 11/24/06, Andrew Haley <aph@redhat.com> 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!
 > >
 > >  > sorry
 > >  > the code is not buggy. i think u have misunderstood the real problem statement.
 > >  >
 > >  > so the problem in more detail is as below:
 > >  >
 > >  > printf("kanishk");
 > >  >
 > >  > the above code compiles perfectly with gcc -Wall.
 > >  > gcc by default puts the string into read execute segment,but 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 in
 > >  > calling sequence (for example it may be regulated by some switch in
 > >  > gcc) or there is no provision in C99 standard for it.
 > >
 > > OK, if it's not a bug, I need to ask another question.  I don't
 > > understand you at all: why do you want to put a constant string into
 > > writable memory?    Is this embedded, or what?
 > 
 > its not.

Well, I'm about to give up, but I'll ask one last question.  You see,
the question you're asking doesn't make any sense.  No correct C or
C++ can possibly be affected by whether literal strings are in
writable memory or not, so your request is utterly baffling.  Why do
you care whether they're in writable memory?

Andrew.

  reply	other threads:[~2006-11-24 13:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-24  9:26 kanishk rastogi
2006-11-24  9:56 ` Andrew Haley
2006-11-24 10:15   ` kanishk rastogi
2006-11-24 10:18     ` Andrew Haley
2006-11-24 10:21       ` kanishk rastogi
2006-11-24 10:24         ` Andrew Haley
2006-11-24 10:31           ` kanishk rastogi
2006-11-24 10:37             ` Andrew Haley
2006-11-24 11:16               ` kanishk rastogi
2006-11-24 11:31                 ` Andrew Haley
2006-11-24 11:40                   ` kanishk rastogi
2006-11-24 13:33                     ` Andrew Haley [this message]
2006-11-24 15:31                       ` Segher Boessenkool
2006-11-24 18:45                 ` John (Eljay) Love-Jensen
2006-11-28  2:57 ` Michael Eager

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=17766.62615.8515.653880@zebedee.pink \
    --to=aph@redhat.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=kanishk.85@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).