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-Thread: 103376,635cd9622b25ae59 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!news.glorb.com!newsfeed.utanet.at!newsfeed01.chello.at!newsfeed02.chello.at!news.hispeed.ch.POSTED!not-for-mail Message-Id: <2051047.MTAq1HeU7p@linux1.krischik.com> From: Martin Krischik Subject: Re: Type safety, C++ and code generation Newsgroups: comp.lang.ada Date: Sun, 30 Apr 2006 20:14:53 +0200 References: <1146143954.169807.207080@t31g2000cwb.googlegroups.com> <1146148380.102042.119860@y43g2000cwc.googlegroups.com> User-Agent: KNode/0.10.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Complaints-To: abuse@hispeed.ch Organization: hispeed.ch NNTP-Posting-Host: 80.218.119.160 (80.218.119.160) NNTP-Posting-Date: Sun, 30 Apr 2006 21:00:03 +0200 X-Trace: 228ba44550933f57fd20506631 Xref: g2news2.google.com comp.lang.ada:4002 Date: 2006-04-30T20:14:53+02:00 List-Id: Maciej Sobczak wrote: > What about making different types really distinct? > > typedef ranged_type R1; > typedef ranged_type R2; > typedef ranged_type R3; > > > Above, R1 and R2 are equal to the compiler, but R3 is distinct from > the other two. This is or can be problematic in those contexts where you > would rather expect them all to be different from each other - > especially when you think in terms of different *domains*, no matter > what is their range of values. This is because "typdef" in C++ is "subtype" in Ada. You would need: class R1 : ranged_type {}; class R2 : ranged_type {}; class R3 : ranged_type {}; to create new types. Martin -- mailto://krischik@users.sourceforge.net Ada programming at: http://ada.krischik.com