[net.lang.c] Making voids work portably

gnu@l5.uucp (John Gilmore) (10/21/85)

In article <493@ttrdc.UUCP>, levy@ttrdc.UUCP (Daniel R. Levy) writes:
> (void)whatever is not supported at all under VAX/VMS C.  It will barf
> severely on (originally) Unix C programs which have been heavily larded with
> (void)'s for the sake of lint.  Not the entire C world is Unix.

Void is well defined and pretty easily portable, though it's true that
many compilers don't fully implement it.  If you write the code
with void, it can be trivially made to work on systems without broken voids
by adding COPTS='-Dvoid=int' to the Makefile -- without source changes.
*That*'s portability...

campbell@maynard.UUCP (Larry Campbell) (10/22/85)

In article <493@ttrdc.UUCP>, levy@ttrdc.UUCP (Daniel R. Levy) writes:
> (void)whatever is not supported at all under VAX/VMS C.  It will barf
> severely on (originally) Unix C programs which have been heavily larded with
> (void)'s for the sake of lint.  Not the entire C world is Unix.

Version 1 of VAX-11 C may not have supported the void type, but version 2
certainly does.
-- 
Larry Campbell                     decvax!genrad
The Boston Software Works, Inc.                 \
120 Fulton St.                 seismo!harvard!wjh12!maynard!campbell
Boston MA 02109                         /       /
                                   ihnp4  cbosgd
ARPA: maynard.UUCP:campbell@harvard.ARPA

geoff@desint.UUCP (Geoff Kuenning) (10/27/85)

In article <202@l5.uucp> gnu@l5.uucp (John Gilmore) writes:

>  If you write the code
>with void, it can be trivially made to work on systems without broken voids
>by adding COPTS='-Dvoid=int' to the Makefile -- without source changes.
>*That*'s portability...

Actually, the safest thing is to use VOID, not void, and use either
-DVOID=void or -DVOID=int on your cc line.  I've used a compiler (Mark
Williams C-86) where voids had severe problems (e.g., the no-pointer-to-
void-functions bug), but the built-in preprocessor wouldn't let me use
-Dvoid=int because void was a keyword it knew!  A quick edit fixed all that.
-- 

	Geoff Kuenning
	{hplabs,ihnp4}!trwrb!desint!geoff