[Vm-dev] VM_PROXY_ version testing

Alistair Grant akgrant0710 at gmail.com
Sun Dec 30 17:37:06 UTC 2018


Hi Eliot,

On Sun, 30 Dec 2018 at 18:34, Eliot Miranda <eliot.miranda at gmail.com> wrote:
>
>
> Hi Alistair,
>
>
> On Dec 30, 2018, at 9:29 AM, Alistair Grant <akgrant0710 at gmail.com> wrote:
>
>
> Hi All,
>
> Recent versions of vmmaker are generating code similar to:
>
> #if VM_PROXY_MAJOR > 1 || (VM_PROXY_MAJOR == 1 && VM_PROXY_MINOR >= 14)
> extern sqInt primitiveFailForOSError(sqLong osError);
> #else
> # define primitiveFailForOSError(osError) 0
> #endif
>
>
> This seems quite dangerous as compiling with an earlier version of the
> VM will succeed, but the plugin will behave in strange ways when run.
> Forcing a compiler failure seems like the safer option, e.g. something
> like:
>
> #error "Not supported on VMs earlier than 1.14"
>
> What do you think?
>
>
> That’s one alternative.  Another is
>
> #else
> # define primitiveFailForOSError(osError) primitiveFailFor(PrimErrOSError)
> #endif

I thought of this one, but the smalltalk code is still going to behave
unexpectedly, and it won't be obvious to the user what the problem is.


> or
>
> #else
> # define primitiveFailForOSError(osError) primitiveFailFor(PrimErrUnsupported)
> #endif

This is much better.


Cheers,
Alistair


More information about the Vm-dev mailing list