From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,43bc631fb4a56c2a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-06-07 05:50:59 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!newsfeed.gamma.ru!Gamma.RU!newsfeed1.bredband.com!bredband!newsfeed1.telenordia.se!algonet!uab.ericsson.se!erix.ericsson.se!newstoo.ericsson.se!not-for-mail From: "Petter Fryklund" Newsgroups: comp.lang.ada Subject: Why not try Checked_Conversion? Date: Thu, 7 Jun 2001 14:50:47 +0200 Organization: ericsson Message-ID: <9fnsdf$h2a$1@newstoo.ericsson.se> References: <9fnbtt$ild$1@e3k.asi.ansaldo.it> NNTP-Posting-Host: 172.17.76.206 X-Newsreader: Microsoft Outlook Express 4.72.2106.4 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 Xref: archiver1.google.com comp.lang.ada:8310 Date: 2001-06-07T14:50:47+02:00 List-Id: Ie if you have subtype Num_T is Natural range 0 .. 3; type Enum_T is (Not_Started, Started, Stopped, Gone); function Checked_Conversion (Num : Num_T) return Enum_T is begin case Num is when 0 => return Not_Started; when 1 => return Started; when 2 => return Stopped; when 3 => return Gone; end case; end Checked_Conversion; Lele wrote in message <9fnbtt$ild$1@e3k.asi.ansaldo.it>... >Hi! >I'm a misterious reader...just because I've read for a month this NG without >take part. >I'm a beginner ADA programmer (what a wonderful language!) and I've a >problem... > >I should convert data types and record data types from one type to another, >since now I've >used the address attribute to point the same memory space and so accede to >from one type >to another. Ada provides features for bypassing certain language >restrictions and these >features are unchecked; it is the programmer's responsibility to make sure >that they do >not violate the assumptions of the rest of the program. Are there particular >risks about using Unchecked_Conversion? Is it a better approach the address >attribute? > >Thanks! > >