* Ian Collins:
What would you store in it?
This is crossposted to [comp.lang.c] and [comp.lang.c++].
I *hate* cross-posted questions about language features. The answers and
considerations are different for all the languages involved. So in the groups
that an answer doesn't apply to it's just noise (sorry, C folks, regarding this
posting). In addition, the probability that people will misunderstand arguments
by not noticing the cross-posting is high. Just more noise.
That said, in C++ one can currently do ...
void foo() {}
void bar() { return foo(); }
.... and this allows e.g. general templatization on the return type, like ...
template< class T > T foo() {}
template< class T > T bar() { return foo<T>(); }
.... and the ability to have pseudo 'void' variables might generalize that to
more situations, more orthogonal and more simple rules, like allowing ...
template< class T >
T bar()
{
T const v = foo<T>();
// blah blah
return v;
}
For the question of whether a pseudo variable like v of type 'void' should have
an address I think the answer is yes, to keep usage simple; analogously C++
already supports dynamic allocation of zero length arrays, with unique address.
However, 'void' is currently defined as just an incomplete type that can never
be completed, because that matches the current semantics. That definition would
have to be replaced, or usage of incomplete types would have to be special-cased
for void. Plus, currently C style '( void )' for an empty formal argument list
is currently supported. And also that would have to go or be special cased (well
it is in a sense already special cased, but even more). And since I can not
recall ever needing the above in sum I think it's absolutely not worth it.
Cheers & hth.,
- Alf