Topic: missing: a (storable) value of type void
Author: stephen.clamage@eng.sun.com (Steve Clamage)
Date: 1996/12/03 Raw View
In article c6108e81@PC34.scanjour.dk, "Lars Thorup" <lth@scanjour.dk> writes:
>
>My compiler (MSVC++ 4.1) prevents me from declaring variables of type void.
>Is the compiler old-fashioned, or does it follow the draft standard in this
>respect?
No object of type void can be declared in either C or C++. That has always
been the rule in both languages.
The pseudo-type "void" was introduced into C as the way to declare that
a function does not return a value, or to say explicitly that the
value of an expression is being ignored.
Later, the type "pointer to void" was introduced to mean "generic
data pointer". It is invalid to dereference a void* or to attempt
pointer arithmetic with a void*. A void* does not point to a void
object, because there is no such thing in C or C++.
---
Steve Clamage, stephen.clamage@eng.sun.com
---
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]