On Sun, Oct 17, 2004 at 12:26:40AM +0200, Andreas Vox wrote:
> 
> Groan -- again!
> 
> /Andreas
> 


> +string const asString(unsigned long i) {
> +     string result;
> +     unsigned long digit = 1;
> +     while ( digit < i ) {
> +             digit *= 10;
> +     }
> +     for (digit /= 10; digit > 0; digit /= 10) {
> +             result += "0123456789" [ (i / digit) % 10 ];
> +     }
> +     return result;
> +}

The same advice as Angus gave to the other function, since this is a free
function and not to be exported anywhere it should be inserted inside an
annonym namespace so that it doesn't polute the global namespace. (If I'm
not explaining this right please someone correct me.)

Also this is not so difficult as that:

namespace {

....

// ends annonym namespace
}

There is no need to indent the code inside, that is why that comment is
placed in the end.

I hope this helps,

-- 
José Abílio Matos
LyX and docbook a perfect match. :-)

Reply via email to