Messages in this thread | | | Date | Wed, 24 Oct 2012 10:56:41 +1100 | From | Stephen Rothwell <> | Subject | Re: [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] | |