Re: debug statements to debugs statements

From: Tsantilas Christos <chtsanti@dont-contact.us>
Date: Sun, 22 Apr 2007 13:50:27 +0300

I do a first conversion from debug statements to debugs statements.
The patch is big (~750K) to post it to mailing list so I put the result
here:
    http://www.chtsanti.net/others/CONVER_DEBUGS.diff
I hope that it is something needed for squid3 because the conversion
takes a lot of my time (specially when you have to merge with many
changes in main squid3 head)......

My Comments:
1) Should I create a temporary branch? If squid developers decide that
this work needed, will be easier the merging with Duane works for large
objects and the merging with main squid code.

2) I did not format the result. I try to run the astyle
(version:1.20.2) and it changed too many things in code. Moreover the
formated code I took as result in some cases was really bad....
   Which version of the astyle used in squid3?

3) I did not convert the debugs statements which have formating strings
with field width or precision modifiers. The reason is that I am not so
sure that the result will be really better. For example a printf
statement like the following:
     printf("Float:%.2f, Hex Integer:%x Dec Integer: %05d \n\n",2.345,
13,13);

using iostreams can be written as:
     cout << "Float:" <<
              setprecision(3) << 2.345 <<
              " ,Hex Integer:" <<
              hex << 13 << dec <<
              " Dec Integer: " <<
              setw(5) << setfill('0') << 13 << endl;

  Moreover a cout << resetiosflags (..) must be included in debugs
statement to avoid a debugs statement change the look of consequently
debugs.
Of course in the other hand, you have not to check if we have float or
double or integer or long long integer.
Are conversions like the above OK?

4) I was not able to use ios manipulators like hex/dec or endl inside
some files eg wccp2.cc file. The compiler (g++ 4.1.2) always return the
following message:
  wccp2.cc:1455: error: Ħhex˘ was not declared in this scope

I try to include iostream and iomanim inside this file but the result
was the same. The strange is that happens only in some of the c++ files
not in all of them.
Any idea?

Regards,
    Christos
Received on Sun Apr 22 2007 - 04:48:41 MDT

This archive was generated by hypermail pre-2.1.9 : Sun Apr 29 2007 - 12:00:03 MDT