Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!apple!lins
From: lins@Apple.COM (Chuck Lins)
Newsgroups: comp.lang.modula2
Subject: Re: (Copy) (in)compatibility between INTEGER and CARDINAL
Summary: Type Compatibility
Keywords: Type compatability, INTEGER, CARDINAL
Message-ID: <35214@apple.Apple.COM>
Date: 3 Oct 89 15:33:07 GMT
References: <"89-10-02-15:04:30.36*UI0T"@DKAUNI2.BITNET>
Organization: Apple Computer Inc, Cupertino, CA
Lines: 35

In article <"89-10-02-15:04:30.36*UI0T"@DKAUNI2.BITNET> Modula2 List  writes:
>I'm not sure wether the following message got out correctly. If you
>
>PROCEDURE  Something(a:ARRAY OF CHAR; n:INTEGER);
>VAR i:CARDINAL;
>BEGIN
>   FOR i:=0 to HIGH(a) DO
>      IF i=n THEN ...
>
>produces two incompatibility errors, one each in the last two lines.
>HIGH returns an INTEGER in this implemenation, and this kind of 'mixing'
>the two types is forbidden by the compiler. To get the same result, I
>

INTEGER and CARDINAL are not compatible within expressions. They may be

>Because of that, I have given up using CARDINAL altogether.

Good. In PIM 4th ed. so has Wirth. And he's removed it from Oberon as well.

>My question is: is this incompatibility between CARDINAL and INTEGER a
>kludge in the compiler, was it meant to be that way by Wirth or is this
>kind of conversion something left to whoever writes a compiler?
>

Wirth designed it this way.

Chuck Lins
-- 
Chuck Lins               | "Exit left to funway."
Apple Computer, Inc.     | Internet: lins@apple.com
20525 Mariani Avenue     | AppleLink: LINS
Mail Stop 41-K           | 
Cupertino, CA 95014      | "Self-proclaimed Object Oberon Evangelist"
I speak for myself and no one else.