lkml.org 
[lkml]   [2012]   [Sep]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] strings: helper for maximum decimal encoding of an unsigned integer
    On Friday 2012-09-14 15:46, Jim Rees wrote:

    >Jan Engelhardt wrote:
    >
    > >A pure K&R-C version would use a string:
    > >#define base10len(i) "\0x1\0x3\0x5\0x8\0x0A\0x0D\0x0F\0x11\0x14"[sizeof(i)]
    > >(if I converted them properly into hexadecimal)
    > The syntax is \x01\x03\x05...
    >
    >K&R doesn't have the \x escape, only \0 (octal).

    People recommend K&R only for the introductory reading, not for its
    actuality.


    \
     
     \ /
      Last update: 2012-09-14 17:01    [W:4.164 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site