Article View: comp.lang.modula2
Article #4284Re: Forwarded mail for Nathan Bohlman
From: Alan Lovejoy
Date: Thu, 16 Jun 1988 16:50
Date: Thu, 16 Jun 1988 16:50
33 lines
2017 bytes
2017 bytes
In article <3179@cognos.UUCP> keithc@cognos.UUCP (Keith Campbell) writes:
>In article <INFO-M2%88060616534629@UCF1VM> Nathan Bohlmann writes:
>>type-casting can be accomplished as follows:
>> If Type1 is of type CARDINAL then to get an value of integer
>> type all you need to do is say INTEGER(Type1). That's all
>> there is to it.
>>There are several other extensions which escape me at the moment...
>
>I believe that the feature to which you refer, is NOT an extension,
>but rather has always been in the definition of modula2. Has some
>standardization effort removed it?
In Wirth's Modula-2, "INTEGER(65535)" has the value -1 (on a two's
complement machine with 16-bit INTEGERs). In BSI/ISO Modula-2, it is an
overflow error. In the first case, the type transfer is not meaning
preserving, but bit-pattern preserving. In the second case, the
opposite is true. The above quote does not explain which option
is implemented by the compiler in question.
I think the BSI approach is superior. BSI also has defined a mechanism
for bit-pattern preserving (non-meaning preserving) type transfers. It
is a pseudo-function that must be imported from SYSTEM and whose name
currently escapes me. So BSI's langauge has the same (in fact, more)
functionality but with different syntax.
--
Alan Lovejoy; alan@pdn; 813-530-8241; Paradyne Corporation: Largo, Florida.
Disclaimer: Do not confuse my views with the official views of Paradyne
Corporation (regardless of how confusing those views may be).
Motto: Never put off to run-time what you can do at compile-time!
Technical Details
Message-ID:
<3493@pdn.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!pdn!alanReferences:
<INFO-M2%88060616534629@UCF1VM> <3179@cognos.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!pdn!alan From: alan@pdn.UUCP (Alan Lovejoy) Newsgroups: comp.lang.modula2 Subject: Re: Forwarded mail for Nathan Bohlman Message-ID: <3493@pdn.UUCP> Date: 16 Jun 88 16:50:41 GMT References: <INFO-M2%88060616534629@UCF1VM> <3179@cognos.UUCP> Reply-To: alan@pdn.UUCP (0000-Alan Lovejoy) Organization: Paradyne Corporation, Largo, Florida Lines: 33