// Compile me with: 
// gcc -O2 -std=c99 -Wall -fshort-wchar ~/a.c

#include <stdio.h>
#include <string.h>

typedef struct {
    int ref;
    int len;
    const wchar_t buffer[4];
} Str;

void giveStr(const Str *pStr)
{
    int i;
    for (i = 0; i< pStr->len; i++) {
        fprintf (stderr, "%c", pStr->buffer[i]);
    }
    fprintf (stderr, "\n");
}

#define EXPAND_FOO(a) L##a
#define DECL_STR(a) \
    ((Str *)(&((const struct { int r; int l; const wchar_t b[strlen(a) + 1]; } ) { (1<<30)+1, strlen(a), EXPAND_FOO(a) })))

#define FOO "baa"


int main (int argc, char ** argv)
{
    giveStr(DECL_STR(FOO));
    giveStr(DECL_STR("Foo"));
    giveStr(DECL_STR("Baa"));
    giveStr(DECL_STR("Wibble"));
    giveStr(DECL_STR("Wibble"));
    giveStr(DECL_STR("Wibble"));
    giveStr(DECL_STR("Wibble"));
    giveStr(DECL_STR("Wibble"));
    giveStr(DECL_STR("Wibble"));
    giveStr(DECL_STR("Fotherington Smythe"));
	return 0;
}
