Re: Problem with the string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/24/06, Andrew Haley <aph@xxxxxxxxxx> 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);


Andrew.
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

thanks in advance

 > On 11/24/06, Andrew Haley <aph@xxxxxxxxxx> wrote:
 > > kanishk rastogi writes:
 > >  > On 11/24/06, Andrew Haley <aph@xxxxxxxxxx> 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.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux