[Webkit-unassigned] [Bug 34548] audio engine: add Vector3 class

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Feb 4 13:05:08 PST 2010


https://bugs.webkit.org/show_bug.cgi?id=34548


Darin Adler <darin at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #48160|review?                     |review-
               Flag|                            |




--- Comment #8 from Darin Adler <darin at apple.com>  2010-02-04 13:05:07 PST ---
(From update of attachment 48160)
Looks good.

> +    Vector3(float* p)

This should be const float*, or actually:

    Vector(const float p[3])

Which documents what the pointer should point to, but is otherwise equivalent.

> +    Vector3(double* p)

Ditto. const double[3] would be best.

> +    // Explicit copy-constructor
> +    Vector3(const Vector3& v)

Why? The compiler will generate exactly this, so why define it explicitly? It's
typically considered better style to omit this.

> +    double dot(const Vector3&) const;
> +
> +    Vector3 cross(const Vector3&) const;
> +
> +    double distance(const Vector3&) const;

Do we need these members? Why not just have plain old functions? Is code that
uses the member function syntax clearer? Could you show me an example?

> +    friend double dot(const Vector3&, const Vector3&);
> +    friend Vector3 cross(const Vector3&, const Vector3&);
> +    friend Vector3 operator*(double, const Vector3&);
> +    friend Vector3 operator+(const Vector3&, const Vector3&);
> +    friend Vector3 operator-(const Vector3&, const Vector3&);

Why do these need to be friends? They should use the public inline x(), y() and
z() functions and so won't need to be friends.

review- for now, but seems generally good

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list