<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 19.07.2012 19:53, Andreas Kling
      wrote:<br>
    </div>
    <blockquote
cite="mid:CABXa4CL=X=AmwuTvbs=pS4MfSBh-Oa67CHtrbJUy_+EHQ5CjiA@mail.gmail.com"
      type="cite">
      <div class="gmail_quote">On Tue, Jul 10, 2012 at 4:52 PM, Brady
        Eidson <span dir="ltr">&lt;<a moz-do-not-send="true"
            href="mailto:beidson@apple.com" target="_blank">beidson@apple.com</a>&gt;</span>
        wrote:<br>
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <div class="im"><br>
            On Jul 10, 2012, at 5:25 AM, Alexis Menard &lt;<a
              moz-do-not-send="true"
              href="mailto:alexis.menard@openbossa.org">alexis.menard@openbossa.org</a>&gt;
            wrote:<br>
            <br>
            &gt; On Mon, Jul 9, 2012 at 6:53 PM, Brady Eidson &lt;<a
              moz-do-not-send="true" href="mailto:beidson@apple.com">beidson@apple.com</a>&gt;
            wrote:<br>
            &gt;&gt;<br>
            &gt;&gt; On Jul 9, 2012, at 2:43 PM, Alexis Menard &lt;<a
              moz-do-not-send="true"
              href="mailto:alexis.menard@openbossa.org">alexis.menard@openbossa.org</a>&gt;
            wrote:<br>
            &gt;&gt;<br>
            &gt;&gt;&gt; Hi,<br>
            &gt;&gt;&gt;<br>
            &gt;&gt;&gt; For those who "secretly" use printf debugging
            :). I know the<br>
            &gt;&gt;&gt; recommended way is to use a debugger and it's
            not the point of this<br>
            &gt;&gt;&gt; discussion.<br>
            &gt;&gt;<br>
            &gt;&gt; A lot of us do this, and sometimes it's necessary.
            &nbsp;I agree with the gripe and support adding something easier.<br>
            &gt;&gt;<br>
            &gt;&gt;&gt; So I propose wtf() and its stream operator.<br>
            &gt;&gt;&gt;<br>
            &gt;&gt;&gt; Usage :<br>
            &gt;&gt;&gt;<br>
            &gt;&gt;&gt;
            wtf()&lt;&lt;"Hello"&lt;&lt;"World"&lt;&lt;3&lt;&lt;4.53322323;
            will output : Hello World 3 4.53322<br>
            &gt;&gt;<br>
            &gt;&gt; There is no reason to bring in stream operators -
            that are willfully absent from WebCore - just for debugging.<br>
            &gt;&gt;<br>
            &gt;<br>
            &gt; But it's really nice for that purpose, and somehow
            match std::cout<br>
            <br>
          </div>
          And we quite purposefully don't use std::cout in the project.<br>
          <div class="im"><br>
            &gt;&gt; Overloading functions works just as well.<br>
            &gt;<br>
          </div>
          &gt; I'm not sure to understand what you mean here&#8230;<br>
          <br>
          I mean relying on C++'s overloading of functions for the
          different types you'd like to printf debug.<br>
          <br>
          void debug(WebCore::String&amp;);<br>
          void debug(WebCore::Frame*);<br>
          void debug(WebCore::Node*);<br>
          <br>
          etc etc etc.<br>
          <br>
          debug(someFrame);<br>
          debug(someNode);<br>
          debug(someString);<br>
          <br>
          Especially that last one would help me from remembering how to
          type "printf("%s", someString.utf8().data())" which is all
          I've ever really wanted.</blockquote>
        <div><br>
        </div>
        <div>Hello fellow printfers!</div>
        <div><br>
        </div>
        <div>While I'm just as ashamed of my printf habits as the next
          guy, I think it'd be great if we could move forward with this
          somehow.</div>
        <div><br>
        </div>
        <div>Coming from a background in Qt, the stream operator syntax
          looks perfectly normal to me, perhaps you could expand on why
          we want to avoid using these in WebKit. Is there a technical
          reason, or is it more of a language purity issue?</div>
        <div><br>
        </div>
        <div>Regardless, adding a consistent set of
          debug(WebCore::MyCoolOverload) methods as suggested would
          still be massively useful.</div>
        <div><br>
        </div>
        <div>-Kling</div>
      </div>
      <br>
    </blockquote>
    <br>
    Hi,<br>
    <br>
    I am probably one of those people who much dislike printf-debugging.<br>
    What is your problem with using a debugger?<br>
    <br>
    Maybe because the displayed information is not appropriate?<br>
    E.g., you would like<br>
    &nbsp;&nbsp;&nbsp; someString.utf8().data()<br>
    instead of<br>
    &nbsp;&nbsp;&nbsp; someString<br>
    <br>
    FWIW, there is a gdb python API for changing the behavior... so
    called pretty printers.<br>
    It is not too difficult to write such pretty-printers.<br>
    <br>
    Maybe providing a set of useful pretty-printers is a better approach
    than providing a set of debug functions?<br>
    <br>
    Regards,<br>
    Oliver<br>
    <br>
  </body>
</html>