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!news.maxwell.syr.edu!news-rtr.nyroc.rr.com!news-out.nyroc.rr.com!twister.nyroc.rr.com.POSTED!53ab2750!not-for-mail From: "REH" Newsgroups: comp.lang.ada,comp.lang.c++,comp.realtime,comp.software-eng 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> <1110052142.832650@athnrd02> <42309456$1@news.broadpark.no> <1110569032.207770@athnrd02> <1110607809.837000@athnrd02> Subject: Re: [OT] Re: Teaching new tricks to an old dog (C++ -->Ada) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 Message-ID: <8rBYd.89121$H05.40145@twister.nyroc.rr.com> Date: Sat, 12 Mar 2005 12:40:36 GMT NNTP-Posting-Host: 66.24.208.111 X-Complaints-To: abuse@rr.com X-Trace: twister.nyroc.rr.com 1110631236 66.24.208.111 (Sat, 12 Mar 2005 07:40:36 EST) NNTP-Posting-Date: Sat, 12 Mar 2005 07:40:36 EST Organization: Road Runner Xref: g2news1.google.com comp.lang.ada:9223 comp.lang.c++:45289 comp.realtime:1355 comp.software-eng:4918 Date: 2005-03-12T12:40:36+00:00 List-Id: "Ioannis Vranos" wrote in message news:1110607809.837000@athnrd02... > I am pretty sure one can write a library that can enable just that. > > > Now that I am thinking of it, there are some, and let's begin from Boost: > > > http://www.boost.org/libs/integer/integer.htm > > > #include > > > int main() > { > using namespace boost; > > int_t<24>::least my_var; > } > > > > with "least" being the smallest built-in type that supports the given bit > count. > > > > You see, that's easy. :-) Just "plug in" Boost. > Yes, I'd used Boost. It's an amazing library, but the above is not equivalent to what I wrote. The major different, and the feature I'd mainly like to see in C++ in that the definition of Byte above is a unique type. It can participate in overload resolution. Different typedefs using int_t<24> are not distinct. I know this can be achieved with an extra template parameter, enums, or classes, but I don't want to go to that kind of effort just to tell the compiler to treat it as a unique type. Another difference, in C++ you cannot create an array of int_t<3> and have all the element be exactly 3 bits. Using 'size and 'component_size (or even pragma pack), in Ada you can. I can also specify a range other than zero to max. You may not care (as your other post suggests), but for fault tolerance, I do. Don't get me wrong. I'm not one of the C++ bashers (I think language-bashing is nonsense). C++ is my favorite language. But Ada has some really nice features I'd like to see in it. I don't care about the forced range checking. I don't think that "fits" C++. I would however, like to be able to easily define unique types of primatives. Being able to portable and explicitly define its size in bits (so that arrays and structs obey) would be nice, too.