This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: request for new a syntactic design for C/C++.
- From: Ian Lance Taylor <iant at google dot com>
- To: "Vladimir 'Yu' Stepanov" <vys at renet dot ru>
- Cc: gcc at gcc dot gnu dot org
- Date: 10 Jul 2006 09:40:38 -0700
- Subject: Re: request for new a syntactic design for C/C++.
- References: <44B1EB23.6050404@renet.ru>
"Vladimir 'Yu' Stepanov" <vys@renet.ru> writes:
> Current syntax C/C++:
>
> load_ptr = typeof(load_ptr)(((char *)init_ptr) - \
> offsetof(typeof(init_ptr), field);
>
> The offered syntax:
>
> &load_ptr->field = init_ptr;
Interesting idea, but C/C++ programmers expect that an assignment sets
the entire expression on the left of the '='. So I don't think this
is a good syntax.
In fact you can already write what you want with a macro, one quite
similar to offsetof, so I don't think we need any new syntactic sugar
here.
> C++:
> struct some_struct &link = other;
This already means something in C++: it means to create a reference.
Ian