[webkit-dev] WebCore Code Cleanup

Eric Seidel eseidel at apple.com
Tue Dec 6 14:06:59 PST 2005


On Dec 4, 2005, at 7:31 AM, Alexey Proskuryakov wrote:

> Hi!
>
> On Sun, 4 Dec 2005 05:31:10 -0800 Eric Seidel <eseidel at apple.com>  
> wrote:
>
>> Any complaints?
>> Any ifdefs which I haven't listed there which you'd like to make  
>> sure  we don't remove?
>
>   I'm using DECODER_DEBUG all the time, and have used TOKEN_DEBUG  
> once. So, I would prefer to have at least the former preserved  
> (changing kdDebug to fprintf or cerr is OK with me, though).
>
>   Hard to comment about other ifdefs. Guess it depends on how  
> rotten the code is... After all, the logs are what helped to write  
> this code in the first place, so they are supposed to be positioned  
> better than something one can add ad hoc :)

This is exactly why I sent out this note!  If folks are still using  
these, then we should keep them.

We're slowly removing them anyway, but perhaps we could replace them  
with something smaller and cleaner?

Perhaps a define like DECODER_DEUBG("my great message %s",  
myGreatCharStar);

There are a couple problems with the existing approach:

1.  It's big and ugly.  (3 lines for a little log)
2.  If you don't use the #ifdefs, due to the c++ stream syntax, there  
is no way to no have everything right of << not executed at runtime,  
for example:
kdDebug(123) << doSomethingReallySlowly() << touchABunchOfMemory()  
<<endl;

These are some of the reasons why we've been slowly removing these  
blocks (both the ifdefs and the raw kdDebug(123) stuff).

-eric




More information about the webkit-dev mailing list