On Wed, 24 Oct 2012 00:32:54 +0200 Peter Zijlstra <[email protected]> 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 [email protected]
pgpaazb0Wq7Sv.pgp
Description: PGP signature

