Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!psitech!david From: david@psitech.UUCP (david Fridley) Newsgroups: comp.std.c Subject: Re: Error Return (was Re: (char *)(-1)) Summary: Embedded Systems Keywords: error, flag, exception Message-ID: <123@psitech.UUCP> Date: 5 Aug 89 20:41:45 GMT References: Organization: PsiTech Inc., Fountain Valley, CA Lines: 24 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.