Re: A simple query about memory mgmt | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] | |
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:
>>> On 13-08-08 02:57, Peter Teoh wrote:
>>>
>>>> But since u have assigned it to the same address of NAME, it will always
>>>> print HELLO world. So the whole thing has nothing got to do with
>>>> optimization (gcc -O0 to disable it, which is also default).
>>>
>>> Can y'all please just listen to Johannes? It definitely does. We have:
>>>
>>>> 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.
>
> Hannes
>
--
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]
![]() |
![]() |