RE: [AD] C++ fix class and -Weffc++ compiler flag.

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]



> book really are, heh. This flag helps find lots of insidious
> little
> potential bugs
> and I really like it :)

You mean, you don't get gigabytes of error messages coming
from the standard includes ??? :) I soon after removed the
-Weffc++ flag from my Makefile ;)

Well, of course I do. But just because the standard C++ library doesn't live up to -Weffc++ doesn't mean that Allegro has to sink to its level :P

I mainly add -Weffc++ to my makefile just before a major release so I can clean up my code without having to sort through the same warnings every time I compile something.

If you have the original Allegro in allegro/ and the fixed
Allegro in allegro_fixed, you can:
diff -r -U 3 -N allegro/ allegro_fixed/ > patch.diff
This will create a usable patch for Peter/Eric.
Remember to make clean (or distclean etc) before, so the
generated files don't clutter the patch.

make clean... hehe, why does it delete the files one-by-one? It took me like 15 minutes :P

Okay, I've attached the patch. I did it like Vincent said, so I hope it's okay. It's about 1 and a quarter kilobytes, which doesn't sound quite right to me since what I changed was only about a hundred bytes, but I don't know how diff works, so... yeah.

BTW, I'm subscribed to [AD], so you don't have to send me replies personally :)

Nick

_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx diff -r -U 3 -N allegro_old\include\allegro\fix.h allegro\include\allegro\fix.h
--- allegro_old\include\allegro\fix.h	Sat Jul 13 10:22:06 2002
+++ allegro\include\allegro\fix.h	Fri Jul 19 23:54:00 2002
@@ -29,14 +29,14 @@
public:
   fixed v;

-   fix()                                     { }
-   fix(const fix &x)                         { v = x.v; }
-   fix(const int x)                          { v = itofix(x); }
-   fix(const long x)                         { v = itofix(x); }
-   fix(const unsigned int x)                 { v = itofix(x); }
-   fix(const unsigned long x)                { v = itofix(x); }
-   fix(const float x)                        { v = ftofix(x); }
-   fix(const double x)                       { v = ftofix(x); }
+   fix() : v(0)                              { }
+   fix(const fix &x) : v(x.v)                { }
+   fix(const int x) : v(itofix(x))           { }
+   fix(const long x) : v(itofix(x))          { }
+   fix(const unsigned int x) : v(itofix(x))  { }
+   fix(const unsigned long x) : v(itofix(x)) { }
+   fix(const float x) : v(ftofix(x))         { }
+   fix(const double x) : v(ftofix(x))        { }

   operator int() const                      { return fixtoi(v); }
   operator long() const                     { return fixtoi(v); }



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/