This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: two ideas to improve C++
- From: Ian Lance Taylor <iant at google dot com>
- To: Ireneusz Szpilewski <irek at szpilewski dot opole dot pl>
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 20 Oct 2009 17:44:28 -0700
- Subject: Re: two ideas to improve C++
- References: <4ADE5CC2.80409@szpilewski.opole.pl>
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