Boost logo

Boost :

From: Noel Yap (yap_noel_at_[hidden])
Date: 2002-08-21 06:29:23


--- "Victor A. Wagner, Jr." <vawjr_at_[hidden]> wrote:
> At Tuesday 2002/08/20 21:45, you wrote:
> >The question of how to support the double word
> results of
> >multiplying two words ecently came up on the C++
> committee
> >reflector. The choices seem to be either providing
> a special
> >function, or providing typedefs for which idioms
> like the
> >following can result in optimal code:
> >
> > uword_t x, a;
> > ulong_t y = ulong_t(x) * a;
> >
> >To which we can add:
> > uword_t b;
> > ulong_t y = ulong_t(x) * a / b;
> >
> >I should think that most compilers already do a
> good job,
> >given suitable choices of uword_t and ulong_t, but
> I haven't
> >done any testing to find out.
>
> This is also one of my pet peeves about a language
> that purportedly lets
> you code "down to the sand".
> also missing is the concept of carry or overflow
> that is readily detectable
> at the language level.
> The _real_ problem isn't addressed by Band-Aids like
> the BCPL muldiv(x, a,
> b) but at least THAT language had it as part of the
> standard library.

One /could/ create their own function using "asm". If
portability is needed, the preprocessor should be able
to do the job. IMHO, if I understand the problem
correctly, treating:

    x = y*z/u;

differently from:

    x = y*z;
    x /= u;

would complicate the language.

MTC,
Noel

__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com


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