When does void make code less readable?

Gary S. Moss AMXBR-VLD-V moss at Brl-Vld.ARPA
Fri Mar 8 03:14:32 AEST 1985


How about keeping the error handling at the higher level AND freeing
that code from verboseness ...

char *
my_malloc( bytes, err )
unsigned	bytes;
void		(*err)();
	{
	extern char	*malloc();
	char		*ptr;

	if(	(ptr = malloc( bytes )) == NULL
	    &&	err != (void(*)()) NULL
		)
		{
		(*err)();
		}
	return	ptr;
	}

Now, I am not saying this needs to be in the 'C' library, you can't protect
people by giving them a false sense of security.
&- Moss -&



More information about the Comp.unix mailing list