Boost logo

Boost :

From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2006-07-03 18:30:05


On Sun, 2 Jul 2006 09:52:26 -0700, Sean Parent <sparent_at_[hidden]>
wrote:

>[snip]
>md5 and SHA code
> <http://opensource.adobe.com/classadobe_1_1md5__t.html>
> <http://opensource.adobe.com/group__adobe__sha.html>
> Review and a short tutorial

I had a quick look to this, as I was implementing an md5 accumulator
myself. One thing that hit my eyes were all those C-style macros, in
particular this one

 #define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))

I guess you know: if used with n=0 (or n=32) on a 32- bit width
integer it invokes undefined behavior.

>[...]
>
>Final <http://opensource.adobe.com/group__adobe__final.html>
> I don't use inheritance much but this would be a nice addition to
>Boost utilities.

I suppose the reason why this has never been included is that it can't
be generalized as we usually like on boost :)

  template<class T>
  class final
  {
   private:
   final() { }
   friend class T;
  };

I'd add another base class to this so that the user hadn't to remember
to write virtual, but that's not the main point. In any case, this
does not prevent derivation: it prevents *instantiating* any derived
class (so a derived class which would only have static members... :)).

It will probably get into boost when "friend class T" will become
legal; but again, I suppose, as there's a school of thought saying it
is of no use: to make a class non derivable specify that it shouldn't
be derived from, in the docs.

>[...]
>I'd be happy to
>help out anyone who has the time to prepare some of these libraries
>(or any other library from ASL) for inclusion in Boost - ASL would
>also benefit from such an effort.

Everyone benefits from good code :)

--
[ Gennaro Prota, C++ developer for hire ]
[    resume:  available on request      ]

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk