Octal Literals

Simen Kjaeraas simen.kjaras at gmail.com
Wed Jul 18 08:06:21 PDT 2012


On Wed, 18 Jul 2012 16:45:58 +0200, Dave X. <dxuhuang at gmail.com> wrote:

> Not that this really matters, but out of curiosity, how does this  
> template work?

It converts the passed number to a string, then works on a digit at a
time. Basically:

foreach ( digit; number ) {
    if ( digit >= '0' && digit <= '9' )
       result = result * 8 + digit;
}

-- 
Simen


More information about the Digitalmars-d mailing list