Google
  Web www.spinics.net

Re: A simple query about memory mgmt

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


On 13-08-08 07:53, Manish Katiyar wrote:

On Wed, Aug 13, 2008 at 11:21 AM, Johannes Weiner <hannes@xxxxxxxxxxxx> wrote:
"Manish Katiyar" <mkatiyar@xxxxxxxxx> writes:
On Wed, Aug 13, 2008 at 10:07 AM, Rene Herman <rene.herman@xxxxxxxxxxxx> wrote:

int main()
{
   char *p_name = "santosh";
   char *q_name = "santosh";
It is unspecified whether or not the compiler will allocate one or two
copies of the character sequence "santosh" and therefore whether or not
p_name != q_name;
Refer to below link ...... first bullet clearly says that gcc will
store only one copy if strings are identical.

http://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/Incompatibilities.html
gcc is one compiler out of many.  While gcc might always collapse them,
others might not always or never at all do so.

Yeah... I completely agree :-) ... the output will be compiler
dependant.......was just saying that if you use gcc you are guaranteed
to get the same address.

Damned if I'm going to check but I remember this being an issue with GCC at some point so I doubt that that the first version of GCC that I used (2.7.2) already did or reliably did in fact...

Rene.

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Newbies FAQ]     [Kernel List]     [Site Home]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Rubini]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Networking]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]     [DDR & Rambus]     [UNIX Filesystems]     [Linux Resources]

Add to Google Powered by Linux