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,703c4f68db81387d X-Google-Thread: 109fba,703c4f68db81387d X-Google-Thread: 115aec,703c4f68db81387d X-Google-Thread: f43e6,703c4f68db81387d X-Google-Attributes: gid103376,gid109fba,gid115aec,gidf43e6,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!proxad.net!newsfeed.stueberl.de!newsfeed.freenet.de!news.tu-darmstadt.de!tsicnews.teliasonera.com!news.otenet.gr!news.grnet.gr!newsfd02.forthnet.gr!not-for-mail From: Ioannis Vranos Newsgroups: comp.lang.ada,comp.lang.c++,comp.realtime,comp.software-eng Subject: Re: [OT] Re: Teaching new tricks to an old dog (C++ -->Ada) Date: Sat, 05 Mar 2005 22:14:44 +0200 Organization: FORTHnet S.A., Atthidon 4, GR-17671 Kalithea, Greece, Tel: +30 2109559000, Fax: +30 2109559333, url: http://www.forthnet.gr Message-ID: <1110053691.117106@athnrd02> References: <4229bad9$0$1019$afc38c87@news.optusnet.com.au> <1110032222.447846.167060@g14g2000cwa.googlegroups.com> <871xau9nlh.fsf@insalien.org> <3SjWd.103128$Vf.3969241@news000.worldonline.dk> <2826628.d8srykTIx7@linux1.krischik.com> NNTP-Posting-Host: athnrd02.forthnet.gr Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: athprx02.forthnet.gr 1110053694 23663 193.92.150.73 (5 Mar 2005 20:14:54 GMT) X-Complaints-To: abuse@forthnet.gr NNTP-Posting-Date: Sat, 5 Mar 2005 20:14:54 +0000 (UTC) User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en In-Reply-To: <2826628.d8srykTIx7@linux1.krischik.com> Cache-Post-Path: newsfd02!unknown@ppp36-adsl-149.ath.forthnet.gr Xref: g2news1.google.com comp.lang.ada:8668 comp.lang.c++:44206 comp.realtime:952 comp.software-eng:4483 Date: 2005-03-05T22:14:44+02:00 List-Id: Martin Krischik wrote: > Well that's easy: > > unsigned int X = -1; > > char Y [10]; > Y [10] = "X"; > > Or bit more subtle: > > unsigned int X Day_Of_Month = 32; Day_Of_Month does not compile. You can make the Day_Of_Month an enum: enum Day_Of_Month { Mon=1, Sun=7}; int main() { Day_Of_Month X= 32; } C:\c>g++ temp.cpp -o temp.exe temp.cpp: In function `int main()': temp.cpp:6: error: invalid conversion from `int' to `Day_Of_Month' C:\c> The char Y thing does not compile, but try this: #include int main() { using namespace std; vector Y (10); Y.at(10) = 'X'; } The most important thing that you may be missing, is that in C++ you can choose the level of abstraction and safety you want by using some third-party library or framework that fits your needs. For example consider this: // Using .NET facilities int main() { using namespace System; array ^IntArray= {1,2,3,4,5,6,7,8,9,0}; IntArray[10]= 10; } C:\c>temp Unhandled Exception: System.IndexOutOfRangeException: Index was outside the boun ds of the array. at main() C:\c> #include #include int main() { using namespace System; using namespace std; int x= 71; char c= x.ToString()[0]; cout<Length<temp 7 2 C:\c> The above make use of the .NET 2 framework facilities, which provide additional safety and the high level things you are mentioning. Bottom line is in C++ you can be as safe and as high level you like. Just pick the suitable libraries or frameworks. -- Ioannis Vranos http://www23.brinkster.com/noicys