Re: a simple formatter

From: Amos Jeffries <squid3@dont-contact.us>
Date: Fri, 8 Feb 2008 16:10:47 +1300 (NZDT)

> On Fri, 2008-02-08 at 14:31 +1300, Amos Jeffries wrote:
>> > On Wed, 2008-02-06 at 21:26 +0200, Tsantilas Christos wrote:
>> >> Do we need something like that? Any comments/suggestions? Any
>> testers?
>> >
>> > I believe we do and I appreciate you working on it! Please try to fix
>> > the remaining problems Amos pointed out.
>> >
>> > Also, can you apply it to the entire Squid tree, remove all
>> whitespace,
>> > and calculate md5, comparing that with the virgin whitespace-less
>> tree?
>> > The MD5s should be the same, right?
>>
>> Oooh. Nice test.
>>
>> >
>> > This is not a perfect check because spaces within strings/etc are
>> > stripped and not checked, but it is a pretty good one.
>>
>> It will also miss the "#if 0 {" block problem.
>
> Are there free C++ source code obfuscation programs? If they are
> guaranteed to generate the same source code regardless of formatting,
> then applying them would catch even more bugs.
>
> Too bad compilers produce different output for each execution due to
> timestamps and such.

What do you mean by this? A standard entry-level compiler test is that it
produces the same output from the same input every time.

Beginner students are taught that in the bootstrapping lessons: "If it
compiles its own code and produces a different binary, do it again until
it stops or breaks. If it breaks you started with buggy code and still
have work to do."

> Perhaps there is a way to avoid that and compare
> md5s of squid executables?
>
> Cheers,
>
> Alex.
> P.S. A basic test file would be good to have anyway, so thank you for
> bootstrapping that.

I thought it would be helpful if you and Christos decided on an astyle
formatter. Turned out right.

Amos
Received on Thu Feb 07 2008 - 20:10:51 MST

This archive was generated by hypermail pre-2.1.9 : Sat Mar 01 2008 - 12:00:09 MST