Error Return (was Re: (char *)(-1))

david Fridley david at psitech.UUCP
Sun Aug 6 06:41:45 AEST 1989


variable,  which makes the function not reenterant or relocateable. (Unless
you have the hardware and CPU power to support virtual memory and tasking.)

The problem with #define errval(x) if(x<0) is that in many systems the stack
is around the top of memory, and therefore many stack variables would be
negative.

The MAGIC_1 idea seems good, you are just trying to identify values that 
pointer can not have.  If we use #defines for thes values and put them in
errno.h then the function will be common across systems even if the values
are not.

Wouldn't it be nice if you could return more than one value from a C function?
ie:
	(ret1,ret2)=func(param1,param2,param3);
I believe this would solve are error problems, and many others that I have had.



-- 
david.
DISCLAIMER: If it's important have a backup.  If it ain't broke don't fix it.
Proceed at your own risk.  My oponions are MY own.  Spelling does not count.
My fondest dream is to leave this planet.



More information about the Comp.std.c mailing list