Boost logo

Boost :

From: Daniel Frey (d.frey_at_[hidden])
Date: 2008-07-31 13:25:45


On Thu, 2008-07-31 at 12:16 -0500, Michael Marcin wrote:
> Neal Becker wrote:
> > Daniel Frey wrote:
> >
> >> On Thu, 2008-07-31 at 07:47 -0400, Neal Becker wrote:
> >>> I have the beginning of a fixed-pt binary lib. Fixed-pt is popular in
> >>> DSP applications. It is integer arithmetic, but keeping track of the
> >>> binary pt.
> >>>
> >>> It is built on top of constrained_value.
> >>>
> >>> It is small, so I include it here:
> >> I think you should return self& instead of self from most of the
> >> operators.
> >>
> > Yes, thanks (oversight)
> >
>
> Be sure to check the size of your type with your compiler. Some embedded
> and DSP compilers in the past made types that derive from operators
> larger. Although I think that was partially due to a operators bug that
> was fixed a long time ago.

AFAIK that's not a bug in the operators library, but an inefficiency in
the compiler's ABI (the EBO actually, which misses some optimization
opportunities for multiply inheritance from empty base classes). If your
compiler is inefficient, you can use the case class chaining technique
offered/supported by the operators library (currently, Neal's code is
*not* using it). See the documentation at
<http://www.boost.org/doc/libs/1_35_0/libs/utility/operators.htm#chaining>.

Regards, Daniel


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk