[Webkit-unassigned] [Bug 87183] Web Inspector: CodeGeneratorInspector.py: protect typed API from C++ implicit float to int cast

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed May 23 03:20:25 PDT 2012


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





--- Comment #3 from Andrey Kosyakov <caseq at chromium.org>  2012-05-23 03:19:29 PST ---
(From update of attachment 143419)
View in context: https://bugs.webkit.org/attachment.cgi?id=143419&action=review

I don't like the way we black-list types that should not be converted. How about more generic approach, e.g.

emplate<typename T1, typename T2> struct no_implicit_cast {
};

template<typename T> struct no_implicit_cast<T, T> {
    static void assign(T& l, const T& r) { l = r; }
};

template<typename T> class exact_type {
private:
    T value;

public:
    template<typename T2> exact_type(T2 v) { no_implicit_cast<T, T2>::assign(value, v); }
    operator T() const { return value; }
};

> Source/WebCore/inspector/CodeGeneratorInspector.py:2262
> +template<> class ExactlyIntHelper<float> { /* no cast method for float */ };
> +template<> class ExactlyIntHelper<double> { /* no cast method for double */ };

So why just float and double? What about char?

-- 
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