Article View: comp.lang.modula2
Article #2653Re: Report on defect in M2 vs C (Was Modula-2, Modula-3, C or C++)
From: Robert I. Eachus
Date: Wed, 25 Oct 1995 22:38
Date: Wed, 25 Oct 1995 22:38
37 lines
2281 bytes
2281 bytes
In article <46kt1q$885@fred.netinfo.com.au> Alan E Brain <aebrain@dynamite.com.au> writes:
> A good rule is: if ever you're doing an unchecked conversion,
> implicit or explicit, you need a debugger. And Unchecked Conversion
> is nearly always essential in I/O ( and nearly always NOT needed
> otherwise).
Don't try to scare impressionable children. There are uses for
Unchecked_Conversion in Ada, especially in Ada 83, which have nothing
to do with either I/O or debuggers.
One typical case is when you need to do a view conversion where,
due to other language rules, the compiler doesn't know that two types
are related (derived directly or otherwise from a single parent) at
the point one type needs to be converted to the other. Another is
when two arrays have components with different subtypes, but you want
to convert in the "right" direction:
subtype lower_case is Character range 'a'..'z';
type e_e_cummings is array(Natural range <>) of lower_case;
To convert e_e_cummings to String, you may want to use
Unchecked_Conversion. Of course, you should write a character by
character loop to convert to e_e_cummings, and I don't know what you
do to understand his poetry. ;-)
--
Robert I. Eachus
with Standard_Disclaimer;
use Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...
Technical Details
Message-ID:
<EACHUS.95Oct25183836@spectre.mitre.org>Path:
arc1-ca.pugleaf.net!linus.mitre.org!spectre!eachusReferences:
<44hcri$rsm@theopolis.orl.mmc.com> <DFyAJF.KpC@research.att.com> <DG1yzI.8Ln@mv.mv.com> <45cj8d$red@ixnews3.ix.netcom.com> <DG8y40.BMz@world.std.com> <KANZE.95Oct11123925@slsvgqt.lts.sel.alcatel.de> <460ibq$b0j@reuters2.mitre.org> <cspt.1144.30867CCE@giraffe.ru.ac.za> <4662pc$kmi@ubszh.fh.zh.ubs.com> <dewar.814190504@schonberg> <46kt1q$885@fred.netinfo.com.au>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!linus.mitre.org!spectre!eachus From: eachus@spectre.mitre.org (Robert I. Eachus) Newsgroups: comp.lang.modula2,comp.lang.modula3,comp.lang.c,comp.lang.c++,comp.lang.ada Subject: Re: Report on defect in M2 vs C (Was Modula-2, Modula-3, C or C++) Date: 25 Oct 1995 22:38:36 GMT Organization: The Mitre Corp., Bedford, MA. Message-ID: <EACHUS.95Oct25183836@spectre.mitre.org> References: <44hcri$rsm@theopolis.orl.mmc.com> <DFyAJF.KpC@research.att.com> <DG1yzI.8Ln@mv.mv.com> <45cj8d$red@ixnews3.ix.netcom.com> <DG8y40.BMz@world.std.com> <KANZE.95Oct11123925@slsvgqt.lts.sel.alcatel.de> <460ibq$b0j@reuters2.mitre.org> <cspt.1144.30867CCE@giraffe.ru.ac.za> <4662pc$kmi@ubszh.fh.zh.ubs.com> <dewar.814190504@schonberg> <46kt1q$885@fred.netinfo.com.au> NNTP-Posting-Host: spectre.mitre.org In-reply-to: Alan E Brain's message of 25 Oct 1995 08:38:18 GMT