lkml.org 
[lkml]   [2012]   [Oct]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [rfc 0/2] Introducing VmFlags field into smaps output
On Wed, 24 Oct 2012 00:32:54 +0200 Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:
>
> On Wed, 2012-10-24 at 01:59 +0400, Cyrill Gorcunov wrote:
> > [ilog2(VM_WRITE)] = { {'w', 'r'} },
>
> since we're being awfully positive about crazy late night ideas, how
> about something like:
>
> #define MNEM(_VM, _mn) [ilog2(_VM)] = {(const char [2]){_mn}}
>
> MNEM(VM_WRITE, "wr"),

The C standard and gcc allow you to initialise the 2 character array with
a (>=2 character) string literal with no casting, so

#define MNEM(_VM, _mn) [ilog2(_VM)] = {_mn}

should work.

[ and the the earlier version,

[ilog2(VM_READ)] = { "rd" },

etc, does work. ]

--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2012-10-24 02:41    [W:0.125 / U:2.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site