Article View: comp.lang.modula2
Article #313Re: Question on Logitech Type Conversion
From: Barry.Cornelius
Date: Mon, 02 Oct 1989 08:22
Date: Mon, 02 Oct 1989 08:22
39 lines
2307 bytes
2307 bytes
Last Saturday, my colleague Randy Bush wrote to this newsgroup thus:
*In article <35093@apple.Apple.COM> lins@Apple.COM (Chuck Lins) writes:
*> DEFINITION MODULE Items;
*> TYPE Item;
*> END Items.
*> ...
*> PROCEDURE CharCompare (left:Item; right:Item): Relation;
*> VAR leftChar : CHAR;
*> BEGIN
*
*But, the type transfer CHAR(left) requires that left occupy the same number of
*bits as a CHAR, and this would not seem to be the case here, where left would
*seem to be a pointer.
*Also, the importing module would seem to be trying to peek through the opaque
*if it tried something like CHAR(left).
*>This all compiles fine under JPI's TopSpeed Modula-2.
*This may not be to their credit.
I guess strictly speaking PIM does not say that 'left' needs to occupy the
same number of bits as CHAR. However, this has been the case with some
implementations, whereas others allow more flexibility. This is the case
with JPI TopSpeed Modula-2, where the size of the expression may be
less-than/equal-to/greater-than the size of the result-type of the type
transfer. With TopSpeed Modula-2 a pointer occupies 4 bytes and so the
type transfer (aka a cast) "CHAR(left)" would deliver one of the bytes of
these four.
My guess is that TopSpeed Modula-2 would not allow "CHAR(left)" to appear
in an importing module, but I have not checked this.
==
Barry Cornelius
==
Computer Science Group, School of Engineering and Applied Science,
University of Durham, Durham, DH1 3LE, England
JANET: Barry.Cornelius@uk.ac.durham
Internet: Barry.Cornelius%durham.ac.uk@cunyvm.cuny.edu
UUCP: ...ukc!cs.nott.ac.uk!bjc
BITNET/EARN: Barry.Cornelius%DURHAM@AC.UK
Tel: Durham (091 or +44 91) 374 2638, Secretary: 374 2630, Fax: 374 3741
Technical Details
Message-ID:
<emu-ul04.lg.1989.1002.092251.cok2@uk.ac.dur.mts>Path:
arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!DURHAM.AC.UK!Barry.CorneliusShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!DURHAM.AC.UK!Barry.Cornelius From: Barry.Cornelius@DURHAM.AC.UK Newsgroups: comp.lang.modula2 Subject: Re: Question on Logitech Type Conversion Message-ID: <emu-ul04.lg.1989.1002.092251.cok2@uk.ac.dur.mts> Date: 2 Oct 89 08:22:51 GMT Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: Modula2 List <INFO-M2%UCF1VM.BITNET@PSUVM.PSU.EDU> Organization: The Internet Lines: 39