Boost logo

Boost :

Subject: Re: [boost] [xint] Third release is ready, requesting preliminary review
From: DE (satan66613_at_[hidden])
Date: 2010-04-30 17:02:08

on 30.04.2010 at 9:35
 Chad Nelson wrote :
> I'm happy to announce that the third release of the Extended Integer
> library is ready, in both the sandbox and the Vault.
> [...]
> Please take a look and let me know what you think of the changes. I'm
> very happy with them.

well i tried to lay my emotions aside and inspect the lib itself

i must say however that the docs are very clear and tell about the
library almost all i want to know
there are wise words there indeed (e.g. on rationale page)

so i think that the design of the library is _perfect_ (yeah, yeah, i
know that there is always room for improvements...)
beside other things i understand why you did things this way and not
the other way

however so far i have a suggestion about fixed_integer
for me it is counter intuitive that a fixed_integer<N> allocates
memory on the heap rather than on the stack
i suggest to reserve storage for data in a static array like

  char fixed_data[sizeof(data_t) + n];

then setting a pointer to data_t (defined in base_integer) like

  data = static_cast<data_t*>(fixed_data);

and then initializing it as usual

classes are not polymorphic and slicing is not intended
in other words the most derived class is responsible for memory
management so if a necessity appears to allocate different storage it
can be correctly freed on destruction like

    if (this->data && this->data!=this->fixed_data)

this way you don't need to rewrite everything and you get rid of
costly allocation
in case you say that data allocated on the heap makes implicit sharing
possible i'd say that copying of reasonable size fixed ints beats
allocations in the end

i hope i got everything right in the implementation and all this
doesn't sound like nonsense
anyway i hope you got the main idea

oh and one more suggestion
when you define a variable that is not meant to be modified declare it
it immediately provides information to a reader and also compiler
ensures your intention

if you notice a grammar mistake or weird phrasing in my message
please point it out

Boost list run by bdawes at, gregod at, cpdaniel at, john at