Re: void vs void* (philosophical question)



Giannis Papadopoulos schrieb:
According to the standard (ISO C99 draft WG14/N1124), void is the
incomplete type that cannot be completed and comprises the empty set of
values. Since it declares the absense of a value can it be considered a
data type?

Regarding void*, is it just a simple reuse of the same keyword (void) or
they have a closer relationship? I could think of only one - a pointer
to an incomplete type. However, if one could say that void is the
absense of a value, how can we have a pointer to something that does not
exist?

Its logical if you think about it in terms of set theorie.

Think of two structs:

struct person
{
char* name;
};


struct worker
{
char* name;
char* job;
};

A pointer person* can point to a struct person and to a struct worker,
so it is a pointer to "at least a person".

A void* is a pointer to "at least nothing", so it can't point to
effectively everything.

Thomas
.



Relevant Pages

  • Re: Types
    ... and a floating point number, and even an integer and a complex number. ... pointer, for double we have double pointer, etc. ... *, i.e. pointers to void. ... An incomplete type is missing some part of the declaration. ...
    (comp.lang.c)
  • Re: 5.3: cant install openoffice 1.1 from ports
    ... > to install gnome2.8, which im using know, great. ... before "void" ... pointer to incomplete type ...
    (freebsd-questions)
  • Re: invalid pointer adress
    ... >> pointer causes the program to exit with a core dump. ... struct s2{void *p;}; ... int leseExterneHinweise_masch_storno ... typedef struct s_AusdatFeldbeschreibung ...
    (comp.lang.c)
  • UInaqble to install OpenOffice 1.1.3 from porte, 5.3R
    ... Im running 5.3R and i've cvsuped ports to get gnome 2.8 running which went fine. ... before "void" ... pointer to incomplete type ...
    (freebsd-hackers)
  • Re: A C Adventure: your comments are welcome
    ... void * usrRightSegment; ... That is a string is a binary tree of segments, ... struct inside a struct either as the thing itself or as a pointer ... because C makes it easy to change pointer type. ...
    (comp.lang.c)