English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Why doesn't ocamlopt detect a missing ; after failwith statement?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-11-29 (07:53)
From: Marcin 'Qrczak' Kowalczyk <qrczak@k...>
Subject: Re: [Caml-list] Why doesn't ocamlopt detect a missing ; after failwith statement?
Jacques Garrigue <garrigue@math.nagoya-u.ac.jp> writes:

> My point was just that, looking at the way void is used in C, it
> clearly does not have the usual proporties of zero, and among them
> the fact no function should be able to return zero, or that all
> pointers to void should be NULL.

Rules of void in C are special. In particular it makes no sense to
draw conclusions about "the number of values of type void" from the
semantics of pointers to void.

There are no values of type void, no variables of type void,
and no function arguments of type void. You can't write
   void deref(void *p) {return *p;}
and this is valid only in C++, not in C:
   void f();
   void g() {return f();}

There are no values of type void. A C function either produces a value
or not. If it does not, it's written by putting 'void' instead of its
return type.

A pointer to void holds an address of some value, not an address of
a value of type void.

Trying to treat 'void' analogously to other types will show
inconsistencies and lead to contradictions.

   __("<         Marcin Kowalczyk
   \__/       qrczak@knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/