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: 109fba,cd8ed9115942852f X-Google-NewGroupId: yes X-Google-Thread: 103376,b92b95c9b5585075 X-Google-NewGroupId: yes X-Google-Attributes: gid4f1905883f,gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!feeder.erje.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: "Jed" Newsgroups: comp.lang.c++,comp.lang.ada Subject: Re: Why use C++? Date: Fri, 12 Aug 2011 10:14:23 -0500 Organization: A noiseless patient Spider Message-ID: References: <1e292299-2cbe-4443-86f3-b19b8af50fff@c29g2000yqd.googlegroups.com> <1fd0cc9b-859d-428e-b68a-11e34de84225@gz10g2000vbb.googlegroups.com> <9ag33sFmuaU1@mid.individual.net> <1d8wyhvpcmpkd.ggiui9vebmtl.dlg@40tude.net> <150vz10ihvb5a.1lysmewa1muz4$.dlg@40tude.net> <1q4c610mmuxn7$.1k6s78wa0r8fj.dlg@40tude.net> <4e44e50a$0$7619$9b4e6d93@newsspool1.arcor-online.net> Injection-Date: Fri, 12 Aug 2011 15:14:04 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="MIpMIVYD9PDhsUAPC84lbA"; logging-data="17295"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19c8s5DwO6r2lZNTk/JyfU2" X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6109 X-RFC2646: Format=Flowed; Response X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 Cancel-Lock: sha1:Nx9zVd6i89O5/p0fl69OOpYjeG8= X-Priority: 3 X-MSMail-Priority: Normal Xref: g2news2.google.com comp.lang.c++:92628 comp.lang.ada:21544 Date: 2011-08-12T10:14:23-05:00 List-Id: "Georg Bauhaus" wrote in message news:4e44e50a$0$7619$9b4e6d93@newsspool1.arcor-online.net... > On 12.08.11 07:03, Jed wrote: >> "Dmitry A. Kazakov" wrote in message > >>> Ada does not have predefined modular types in the package Standard, >>> because >>> any modular type can be constructed using "type T is mod N" >>> construct. >> >> OK, I plainly see what you meant now even without your example. It's >> amazing what a good night's sleep will do. Last night, I was keying-in >> on >> the word "algebra" too much and it blinded me to the overall meaning. >> >> I'm not sure I'd want that level of flexibility in a language. I think >> it >> may be too much effort for too little benefit. It seems it may be >> doing >> something in software that could be supported in hardware but isn't >> (?). >> Maybe too much of a "purist" approach. I'd need more info about it and >> be >> convinced it is worth it before I'd put that on my shortlist of >> compelling features for a language to have. > > Perhaps it is info if beginners in embedded systems programming > consistently produce much better results (statistics collected > and testedover some 6 years) when they have an expressive and > likely more intuitive type system for fundamental types. While that is definitely a good characteristic, I can't evaluate it without knowing what effort it takes to get it. Certainly something like ranged types is easily doable. I'm not sure the scope of what is being called for by those calling for it (e.g., Dmitry), that's the problem. I ranges is one thing, what are the others? > My guess > is that the absence of representation riddles is a boon. I would say that abstraction is nice sometimes, but if you don't have any guarantee of the representation, then that is necessarily a higher-level language than C and C++ are (i.e., higher than "close to the metal). > Put yourself > in the position of a beginner who is woken up at 5p.m. They would not > recall the rules regarding enum vs int, or the collection of > traditional > idioms for declaring arrays in C, autotruncation of numeric values > to fit in the space of LHS; and likely neither the more modern > classes addressing hardware things. Some of those things are decicely deficient, yes, but that is not to say that abstracting-away the representation is always good. Indeed, do that and you have a 4GL rather than a 3GL. > Then, will understanding the type declarations > > type Intensity is range 0 .. 255; > for Intensity'Size use 8; Oh, but I thought you desired to abstract-away the representation. What's that "Size use 8", then, all about? > type RGB is (Red, Green, Blue); > type Pixel is array (RGB) of Intensity; > > require much besides what is written? Compare > > #define RGB_LIMIT 3 > > typedef unsigned char Intensity; > enum RGB {Red, Green, Blue}; > typedef Intensity Pixel[RGB_LIMIT]; > > and > > switch (1) { > case 0: break; > case CHAR_BIT == 8: break; > } > > somewhere. If I am a beginner, what is the number of technicalities > I must know it order to understand the second way of declaring things? > (I'll leave out that the declare-like-used rule in typedef is > confusing many. Maybe that's because the typdef-ed name isn't in some > fixed position in the typedef.)