[Webkit-unassigned] [Bug 32828] WTF should have an arraysize macro

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Oct 24 07:31:45 PDT 2010


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





--- Comment #18 from Patrick R. Gansterer <paroga at paroga.com>  2010-10-24 07:31:44 PST ---
(In reply to comment #17)
> (From update of attachment 71663 [details])
> r- due to various build failures.
I'll split it up into smaller patches, since the JavaScriptCore part builds already and there is no need to this all in one patch.

> I'm a little concerned about ARRAY_LENGTH() being too generic of a name.  What about WTF_ARRAY_LENGTH()?
I'm not very happy with it too.

> Can you make the macro an inline template method instead, or does that make declarations like this unhappy?
There are some problem, since we need the size at compile time:
E.g. the following won't work:
template <typename T, size_t N>
inline size_t array_size(const T (&)[N])
{
    return N;
}
size_t s = array_size(tokens);

But this should work, if we like it more:
template <typename T, size_t N>
struct array_info<T[N]>
{
    enum { size = N };
};
size_t s = array_info<tokens>::size;

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