This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: request for new a syntactic design for C/C++.


"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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]