two ideas to improve C++
Ian Lance Taylor
iant@google.com
Wed Oct 21 14:26:00 GMT 2009
Ireneusz Szpilewski <irek@szpilewski.opole.pl> writes:
> I have 2 ideas about C++ language, maybe they could be implemented as
> GCC C++ extensions (Microsoft has many his own and no one
> complains). :-)
We generally do not want to implement language extensions. It takes a
strong argument to convince us. Also, as a practical matter, we are
extremely unlikely to implement an extension ourselves. So
realistically you need to 1) send us a patch; 2) convince us that it
is worth the ongoing maintenance hassle.
> 1. void as first class type
>
> Current status of void is somewhat strange. It is a type but you
> cannot create objects of type void.
> So, it is type of what? But you can have memory pointer to void, so
> object (or array) of type void
> has its memory position but cannot be here created. Pointer
> arithmetics for void* is forbidden.
> Despite this all, we are allowed to use void as a template type
> parameter. It is not elegant and
> makes C/C++ harder to understand for beginners.
I don't find this argument to be convincing. Sorry. When would I
create an object of type void? Why would I create it?
> Here is my idea - lets add "callback" pointer data type. It would
> require to introduce
> new data type symbol: @. Internally it would contain 2 pointers:
> pointer to object and pointer to member of that object.
As far as I can tell you can write that type yourself. I'm not sure
what has to change in the compiler. It sounds a lot like
std::tr1::bind.
Ian
More information about the Gcc
mailing list