[comp.sys.ibm.pc.programmer] Microsoft C return method

mcdonald@aries.scs.uiuc.edu (Doug McDonald) (04/08/90)

In article <10378@wpi.wpi.edu> jhallen@wpi.wpi.edu (Joseph H Allen) writes:

>Well, Ver 5.0 and up will generate code for both MS-DOS and OS/2, so the
>result code must run under protected mode.  I've also been told by people
>at Microsoft (including one of the lead developers for Windows) that the
>code generated runs under protected mode because it's re-entrant.
>
>| What about returning structures?
>
>I've never used MSC, so I don't know what it does for structures.  However,
>I can't immagine that someone with access to the compiler would have too
>much difficulty finding out.
>

I checked. It returns doubles and structs by putting the values in
static buffers and passing a pointer to those buffers on the stack.
Thus the resulting subroutines are not re-entrant, and hence Microsoft C
5.1 is not ANSI C. This will have to be fixed to be standard ANSI C,
which requires that any subroutine be callable from a signal handler
(i.e. asynchronously). (I don't think that the standard implies that
the USER can't write routines that, because of the way they are written,
aren't reentrant, it just requires that the compiler provide a way to
return any value correctly. )

Doug McDonald