Jump to content
Excelsior Forums
Sign in to follow this  
maurer

Cardinals in xds-modula-2

Recommended Posts

Dear Sir, dear developers,

as far as I have understood it, one _either_ can use 32-bit-CARDINALs _or_ 16-bit-CARDINALs in xds-Modula-2.

This is very unfortunate in my opinion, since on the one hand the advantages of 4 against 2 byte are obvious,

on the other, the data type short int in C (SHORTCARD in Modula-2) is extremely important for use with serveral

C-libraries and system calls in e.g. linux.

Is the a possibility to use _both_, even with type compatibilty

(as e.g.  VAR s: SHORTCARD (* 16 bit *); c: CARDINAL (* 32 bit *);

              BEGIN  (* ... *) c:= s; (* ... *)

?

Yours sincerely

Ch. Maurer

E-Mail: maurer@inf.fu-berlin.de

http.//www.inf.fu-berlin.de/lwb/murus/index.html

Share this post


Link to post
Share on other sites

I'm just guessing here (believe me, I'm no pro, but everyone else seems to be otherwise occupied this week) -  couldn't you use CARDINAL and SYSTEM.CARD16

and

SYSTEM.CAST (*or VAL*)(CARDINAL,c)

?

Share this post


Link to post
Share on other sites

If you would prefer explicit size specifiers, use CARD8, CARD16, CARD32, INT8, IN16, INT32, SET8, SET16, SET32 from the module SYSTEM.

Otherwise set the M2ADDTYPES option and you'll get SHORTs and LONGs (see Native XDS-x86 User's Guide, Chapter "XDS Modula-2", section "Language extensions" -> "Additional numeric types")

Note: You will probably need to set M2BASE16 as well, otherwise INTEGER and LONGINT will refer to the same 32-bit type.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×