gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gm2] INTEGER CARDINAL compatibility


From: Gaius Mulley
Subject: [Gm2] INTEGER CARDINAL compatibility
Date: 22 Feb 2008 22:15:06 +0000
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

Hi,

I'm in the middle of correcting the compatibility between INTEGERs
and CARDINALs during assignment, expression, parameter passing
and INC and DEC.  (With appropriate runtime range checking).

I see from PIM4 and ISO that mixed expressions using an INTEGER
and CARDINAL variable are disallowed.  But I couldn't find whether
this also includes:

MODULE foo ;
VAR
   i: INTEGER ;
   c: CARDINAL ;
BEGIN
   IF i>c
   THEN

   END
END foo.

from my reading is that this is illegal according to ISO and PIM, but
this does seem restrictive..  I was just wondering whether I'd missed
something, or misinterpreted something?

Conversely its my understanding that:

DEC(c, i)    (* legal providing 0 <= i <= MAX(CARDINAL)
                (* the later always true for i *) *)

and 

DEC(i, c)    (* legal providing 0 <= c <= MAX(INTEGER) *)


regards,
Gaius




reply via email to

[Prev in Thread] Current Thread [Next in Thread]