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,UTF8 Path: g2news1.google.com!news3.google.com!newshub.sdsu.edu!newsfeed00.sul.t-online.de!t-online.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 23:57:34 +0200 Organization: FORTHnet S.A., Atthidon 4, GR-17671 Kalithea, Greece, Tel: +30 2109559000, Fax: +30 2109559333, url: http://www.forthnet.gr Message-ID: <1110059861.560004@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> <87r7iu85lf.fsf@insalien.org> <87is4598pm.fsf@insalien.org> <1110054476.533590@athnrd02> NNTP-Posting-Host: athnrd02.forthnet.gr Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: athprx02.forthnet.gr 1110059861 27934 193.92.150.73 (5 Mar 2005 21:57:41 GMT) X-Complaints-To: abuse@forthnet.gr NNTP-Posting-Date: Sat, 5 Mar 2005 21:57:41 +0000 (UTC) User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en In-Reply-To: Cache-Post-Path: newsfd02!unknown@ppp36-adsl-149.ath.forthnet.gr Xref: g2news1.google.com comp.lang.ada:8685 comp.lang.c++:44228 comp.realtime:969 comp.software-eng:4500 Date: 2005-03-05T23:57:34+02:00 List-Id: Pascal Obry wrote: > > And what about: > > int main() > { > int i; > for(i=0; i<10; ++i) > ; > > i=7; > } > > What is important for safety is not what a language permits but what > it forbids. As long as you have traps in a language you know that some > programmers will fall into it at some point. Every variable is visible inside the scope that it was defined. If you want to use i inside a for loop only, then define it in the for loop. The restriction that you imply you desire, limits flexibility. Once again, I have nothing against learning Ada, however personally I like the most powerful languages. The next thing I am going to learn after C++ (because I haven't learned it all yet), is probably some form of assembly language. For example I like that I can do: #include #include #include #include class SomeClass { std::string s; public: SomeClass() { s="This is a text message"; } }; int main() { using namespace std; SomeClass obj; unsigned char *p= reinterpret_cast(&obj); // Displays the individual bytes that obj // consists of as unsigned chars. for(unsigned i=0; i(&obj); // Displays the decimal values of the // individual bytes that obj consists of. for(unsigned i=0; i(p[i])<<" "; cout<<"\n\n"; // Displays the bits of each byte that consist // this SomeClass object p= reinterpret_cast(&obj); for(unsigned i=0; i::digits retrieves the number // of byte's bits, which *is* 8 usually. bitset::digits> bits(p[i]); for(unsigned j=0; jtemp character: ⁿ character: = character: > character: 252 61 62 0 00111111 10111100 01111100 00000000 C:\c> I am sure that many ADA developers will say that this one is not needed (the ability to access the individual bytes of objects is needed in many cases, e.g. to create low level exact copies of objects ) and it is unsafe (yes it is, low level stuff are unsafe and it all depend on the programmer knowing what he does). It is up to oneself to learn whatever languages fits his purposes. For example, a "safe" language is not an interest for me. Someone who places much hopes on the language to protect him from his mistakes, probably ADA is better than C++ on this. There is no language that provides satisfies all people desires, just because some desires are in contrast between them. -- Ioannis Vranos http://www23.brinkster.com/noicys