Click to See Complete Forum and Search --> : who can tell me why C++ does not support a void reference but support a void pointer


earthharp
June 7th, 2002, 10:11 AM
I think if we could use void reference, it could make many things much easier and bring much flexibility.
But it must be initialized when you declared it. Why C++ does not support it ?

JMS
June 7th, 2002, 01:09 PM
By definition there can't be a void variable and thus can't be a void refference to a void variable.

'void' when used as a function return type means the function returns nothing.

'void' when used as a function parameter means that the function takes no parameters.

'void' when used as a pointer type means that the pointer type is a universal pointer but can not be derrefferenced without having first been cast to a specific and different type of pointer.