Article View: comp.lang.modula2
Article #3213Re: Modula2 for C programmers?
From: Martin Whitaker
Date: Tue, 30 Jan 1996 09:02
Date: Tue, 30 Jan 1996 09:02
29 lines
1607 bytes
1607 bytes
In article <DLMz95.9r4@cix.compulink.co.uk>, mark_tbu@cix.compulink.co.uk ("Mark Morgan Lloyd ") writes:
> > neither does it do any sort of interpretation of the bits,
> > i.e. it's a straight copy of the bitmap, if you will..
>
> Watch it! I've argued this one in the past with TopSpeed, who IIRC under
> certain circumstances _do_ apply transformations.
>
Also, IIRC, so did the Logitech V3 compiler. This is, however, incorrect. To
quote Wirth (PIM, 2nd Edition, Chapter 29):
"The key idea behind these transfers is, however, that they do not involve any
actual computation. Hence, in the above examples, INTEGER(c) is used if the bit
pattern representing the cardinal value c is to be interpreted as an integer,
and BITSET(c) is used if it is to be interpreted as a bitset."
The fact that a number of compilers misused the form INTEGER(c) to perform
type conversion, rather than type transfer (casting), is one reason why
this form is not allowed by the ISO standard, and you either have to write
VAL(INTEGER,c) for type conversion
or
CAST(INTEGER,c) for type transfer
The other reason is that CAST must be imported from SYSTEM, which is where
low-level facilities belong.
Martin
Technical Details
Message-ID:
<4ekmq9$3jl@izar.brunel.ac.uk>Path:
arc1-ca.pugleaf.net!nntp0.brunel.ac.uk!usenetReferences:
<DLMz95.9r4@cix.compulink.co.uk>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!nntp0.brunel.ac.uk!usenet From: eesrmtw@brunel.ac.uk (Martin Whitaker) Newsgroups: comp.lang.modula2 Subject: Re: Modula2 for C programmers? Date: 30 Jan 1996 09:02:01 GMT Organization: Brunel University Message-ID: <4ekmq9$3jl@izar.brunel.ac.uk> References: <DLMz95.9r4@cix.compulink.co.uk> Reply-To: eesrmtw@brunel.ac.uk NNTP-Posting-Host: napier.brunel.ac.uk