request for new a syntactic design for C/C++.
Ian Lance Taylor
iant@google.com
Mon Jul 10 16:40:00 GMT 2006
"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
More information about the Gcc
mailing list