[comp.os.minix] Problem with Minix C compiler?

kchen@imagen.UUCP (Kok Chen) (08/24/87)

Has anyone else noticed a bug(?) in the C compiler in returning NULL?

Example:
    |		typedef struct { int member; /* etc */ } STRUCT ;
    |
    |		STRUCT *function()
    |		{
    |		    STRUCT *p ;
    |
    |		    p = (STRUCT *) NULL ;
    |		    return p ;
    |
    |		    return (STRUCT *) NULL ;
    |		}

The first form of return works properly, but the second form does not.  
(I.e., the value of the function using the second return, when compared 
with NULL, will result in a false condition.)

No big thing, since it is easy to work around.  But it can (and did) cause 
a lot of pain until one is aware of it :-)


Kok S. Chen				..!decwrl!imagen!kchen
Imagen Corporation