[webkit-dev] Easing printf based debugging in WebKit with an helper.

Brady Eidson beidson at apple.com
Thu Jul 19 14:53:01 PDT 2012


On Jul 19, 2012, at 2:46 PM, Antti Koivisto <akoivisto at gmail.com> wrote:

> Maciej Stachowiak <mjs at apple.com> kirjoitti 20.7.2012 kello 0.27:
> 
>> 
>> In principle, we could also have this support multiple arguments, so you could write:
>> 
>> debug("frame: ", someFrame, " node: ", someNode, " string", someString);
> 
> I think this is the way to go for the easy syntax. A format string version should also be available.

I'm totally on board with this, too.

~Brady

> 
> 
>  antti
> 
>> 
>> This would be no more verbose than the << style, but could compile to a single function call at the call site and therefore could be relatively compact. I would find this easier to deal with than a unary function or a printf-style format string. The way you'd do this is by defining template functions which call a unary overloaded function for each argument:
>> 
>> template<typename A, typename B> debug(A a, B b)
>> {
>>   debug(a);
>>   debug(b);
>> }
>> 
>> template<typename A, typename B, typename C> debug(A a, B b, C c)
>> {
>>   debug(a);
>>   debug(b);
>>   debug(c);
>> }
>> 
>> template<typename A, typename B, typename C, typename D> debug(A a, B b, C c, D d)
>> {
>>   debug(a);
>>   debug(b);
>>   debug(c);
>>   debug(d);
>> }
>> 
>> ... and so on up to some reasonable number of arguments.
>> 
>> Regards,
>> Maciej
>> 
>> 
>> 
>> 
>> 
>> 
>> _______________________________________________
>> webkit-dev mailing list
>> webkit-dev at lists.webkit.org
>> http://lists.webkit.org/mailman/listinfo/webkit-dev



More information about the webkit-dev mailing list