[M3devel] how to write constants?

Rodney M. Bates rodney_bates at lcwb.coop
Sun Sep 1 23:54:22 CEST 2013



On 08/31/2013 01:17 AM, Jay K wrote:
> What is the right way to do this for 64bit systems?

I presume you mean so it works on both 32-bit and 64-but?

>
>    other       : INT32 = 16_FFFFFFFF;
>
>
> "../src/win32/WinUser.i3", line 1321: warning: value not assignable (range fault)
>    WS_POPUP       : INT32 = 16_80000000;
>
> "../src/win32/WinVer.i3", line 37: warning: value not assignable (range fault)
>    VS_FFI_SIGNATURE    : INT32 = 16_FEEF04BD;
>
>
> I'm guessing..
>   other : INT32 := -1;

Yes, assuming this is the same INT32 as the other two cases (a subrange
covering 32-bit signed twos-complement.  (I couldn't find this declaration,
thus nor its INT32 type.)

> WS_POPUP = FIRST(INT32)

That will work.  Ultimately, the buck has to stop being passed, and
following more levels of transitive type renaming than I want to count,
I see the type defined as [-16_7fffffff-1 .. 16_7fffffff], whose lower
bound is the way I would have done it as a ground constant.

I see two different BasicCTypes.i3 versions, inside subdirectories
32BITS and 64BITS, but this decl is the same in both.

> VS_FFI_SIGNATURE    : INT32 = -17890115; (* 16_FEEF04BD *)
>

Works, but tedious to hand-compute and to double-check consistency with
the comment.  How about 16_FEEF04BD-16FFFFFFFF-1?

Does it seem odd that numbers like this in the upper-half unsigned range
are being given to a signed type?

>
> ?
>
>   - Jay




More information about the M3devel mailing list