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: John Fine <johnsfine at verizon dot net>
- To: Lawrence Crowl <crowl at google dot com>
- Cc: Andrew Haley <aph at redhat dot com>, holderlin <holderlinzhang at gmail dot com>, "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Wed, 21 Jan 2009 08:50:45 -0500
- 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>
Lawrence Crowl wrote:
holderlin wrote:
Is there any difference between (*(x)).a and (x)->a, if x is an
expression which generates a struct pointer.
They are the same for the C language, but may be different in C++
if the struct has overloaded the * or -> operators.
Can they be different in C++ ?
A key phrase in the question is "x is an expression which generates a
struct pointer."
You can overload the meaning of * or -> if x is a struct. I thought you
couldn't overload them if x is a pointer.