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,b92b95c9b5585075 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Bill Findlay Newsgroups: comp.lang.c++,comp.lang.ada Subject: Re: Why use C++? Date: Fri, 12 Aug 2011 18:02:33 +0100 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> <4573053c-23a1-4a23-9afb-fa4d297ff8c5@f41g2000yqh.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Trace: individual.net 9ncfjnidPXtjwZXWqgNAZwCun46XYxEa6QhlViY5ORT6D5nXWK Cancel-Lock: sha1:KKjHMuB1hQI8Ug1O0A7U5Hv5ilU= User-Agent: Microsoft-Entourage/12.28.0.101117 Thread-Topic: Why use C++? Thread-Index: AcxZEaCPlIafFHjmo0S/4gypdU25Zg== Xref: g2news2.google.com comp.lang.c++:92638 comp.lang.ada:21549 Date: 2011-08-12T18:02:33+01:00 List-Id: On 12/08/2011 16:50, in article e9987381-4f7b-4d25-9c9b-429fd4da74f6@k15g2000yqd.googlegroups.com, "Stuart Redmann" wrote: > Stuart Redmann wrote: > [snip] >>> Be honest, how often do you really _want_ a wrapping int? > > On 12 Aug. Vinzent Hoefler wrote: >> Thinking indices instead of pointers, quite often, actually. > > Could you please provide some example? Seriously, I'm really > interested in the usage of wrapping types since in the last ten years > I have not felt the need for wrapping ints at all (well, maybe two or > three times). In my current project, the following are all defined in one unit: type nest_depth is mod 19; type sjns_depth is mod 17; type word is mod 2**48; type field_of_16_bits is mod 2**16; type syllable is mod 2**8; type halfword is mod 2**24; type symbol is mod 2**6; type symbol_number is mod 8; type microseconds is mod 2**64; type priority is mod 2**2; type one_bit is mod 2; type context is mod 2**2; type INS_kind is mod 2**2; type order_counter is mod 2**64; For most of these, the wrapping behaviour is exactly what is needed to model computer hardware (they are from a KDF9 emulator). nest_depth and sjns_depth, in particular, are the index types of cyclic buffers. -- Bill Findlay with blueyonder.co.uk; use surname & forename;