RE: [AD] C++ fix math

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Title: RE: [AD] C++ fix math

> This was just the discussion we were having earlier and that
> is what I
> was lobbying for, was to place the cos operation in the Fix
> class as either:
>
> static fix fix::cos(fix x);
> or
> fix fix::cos();
>
> In C++, classes and namespaces do what prefixes are normally
> for in C,
> so no need to call it fixcos but instead fix::cos.  I believe it was
> decided to leave it as it is, though.

Yes, I was AFK for two weeks, so I've been reading like
crazy, sorry if I'm coming back to beat now dead and cold
horses :)
However, I'd be wary about the whole namespace thing. It's
easier to use namespace'd routines. Koenig lookup springs
to mind (I don't have the whole rule in mind now, but it
says that a routine which is not in scope can be used if
one of its parameters (or its first one only, I'm hazy)
comes from this namespace). eg:

namespace foo {
  class bar {
  public:
    bar() {}
  };
  void baz(bar&) {}
};
void baz(bar&) {}
using foo::bar;
int main(){bar b;baz(b);return 0;}

I think the first baz will be called, though it's not in
scope.

Anyway, all that to say that it's less confusing to name
our stuff differently than libc stuff, even if allowed :)

--
Vincent Penquerc'h



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/