This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: What's the difference between (*(x)).a and (x)->a
- From: holderlin <holderlinzhang at gmail dot com>
- To: Lawrence Crowl <crowl at google dot com>
- Cc: Andrew Haley <aph at redhat dot com>, "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Wed, 21 Jan 2009 11:07:03 +0800
- Subject: Re: What's the difference between (*(x)).a and (x)->a
- References: <4cbaed80901200537g291d9284i2595b4f851588375@mail.gmail.com> <4975E1BC.4070004@redhat.com> <29bd08b70901201603m2216b2ccv63fbb00580e58f38@mail.gmail.com>
I see. Thanks, guys.
On Wed, Jan 21, 2009 at 8:03 AM, Lawrence Crowl <crowl@google.com> wrote:
> On 1/20/09, Andrew Haley <aph@redhat.com> wrote:
>> This shouldn't have been posted to gcc@gcc.gnu.org, which is for gcc
>> development only. Redirecting.
>>
>> holderlin wrote:
>> > Is there any difference between (*(x)).a and (x)->a, if x is an
>> > expression which generates a struct pointer.
>>
>> No. The standard says that in all cases they are the same.
>
> Just to be sure that there is no miscommunication, Andrew is assuming
> that by gcc you mean gcc when compiling C.
>
> They are the same for the C language, but may be different in C++
> if the struct has overloaded the * or -> operators.
>
> --
> Lawrence Crowl
>
--
-------------------
Holderlin Zhang
Department of Applied Math., Nankai University