Topic: Infinite int - is there a reason bitfield syntax should not be


Author: dsp@bdal.de (=?ISO-8859-1?Q?Daniel_Kr=FCgler?=)
Date: Tue, 27 Sep 2005 07:19:35 GMT
Raw View
Hello Thorbj=F8rn,


tmartsum@gmail.com wrote:
> At http://www.research.att.com/~bs/evol-issues.html there is a
> suggestion on an
> an infinite precision integer class. (ES082)

. and there also exist a corresponding proposal for this infinite=20
integer type, namely (big) 'integer', see:

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1744.pdf


> Probably infinite is a "wrong word" ? Because what is most needed is
> a fixed precision. (Compilers can create more optimized code for a
> fixed length).

While this is another possible request, the 'big integer' proposal is of
more general interest, I assume. Some parts of the operations of your
described type request are available from std::bitset (Of course that
is not a very satisfying answer, I know, if you have additive and
multiplicative operations in your mind).


> But why not just make a little extension to the language.
> Is there a reason NOT to allow code like
>=20
> int main()
> {
>   unsigned int x : 256;
>   // Should mean x is an unsigned integer of 256-bits
> }
>=20
> I know there are something to consider e.g.
> Should it provide alignment like the bitfield ?
> (My opinion says no - but I guess that is not interesting -
> there are probably good reasons why it should not be allowed ?)

I don't think that this is a 'little' extension and providing
this extension will probably have the effect, that many usages of
such integer types will result in inefficient integer simulation
types instead of the natural 'register'-like native types.

Greetings from Bremen,

Daniel Kr=FCgler



---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]