Subject: Re: remember that warning about __syscall()?
To: None <current-users@NetBSD.ORG>
From: der Mouse <mouse@Holo.Rodents.Montreal.QC.CA>
List: current-users
Date: 01/10/1997 07:29:10
>> __syscall() could be prototyped to return a *union* of all these things.

>> At the locatation where the actual value is returned, it requires a
>> cast of the value to this union, however, and this is not possible
>> in Standard C.  Gcc will allow it, though.  For portability, a
>> temporary union variable would be required.

> Of course you can do this in standard C:

> union intandlongandoff_t { ... }

> union intandlongandoff_t foo;

> IntFunction(*((int*)(&foo)));
> LongFunction(*((long*)(&foo)));
> OffTFunction(*((off_t*)(&foo)));

Sure.  But that's not what the person above was talking about; the text
says "At the [location] where the actual value is _returned_...".  That
is, this isn't allowed:

union syscallreturn { ... };

union syscallreturn somesyscall(...)
{
 int intvalue;
....
 return(intvalue);
}

As that text says, gcc will let you write

 return((union syscallreturn)intvalue);

though to get that effect in C (as opposed to gcc, which is a
distinctly different language), you'd need a temporary variable of type
union syscallreturn.

					der Mouse

			       mouse@rodents.montreal.qc.ca
		     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B