On Mon, Sep 21, 2020 at 1:55 AM Steve Nickolas wrote: > I've never written anything that uses varargs, so I've never run into > that. But I've actually done quite a bit of work with an environment > where this isn't true: MS-DOS using the large or huge model. In this > environment, sizeof(int)=2, and sizeof(void*) is 4. Of course, it's not > conformant to pass an int variable as an argument where a pointer variable > is expected. > If the compiler was ISO-conformant (which it almost certainly was not), that would not matter. 0 in int context would be a 2-byte int with all bits zero, and 0 in pointer context would be a 4-byte null pointer, probably with all bits zero. C doesn't require that the address represented by the null pointer (whether or not it is all-bits-zero) is inaccessible, merely that there is no C object or function there. A simple shim of the appropriate size (1, 2, 4, 8 bytes depending on the CPU's alignment rules) will suffice.