Re: Specify alignment for string literal.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Kaz Kylheku <kaz@xxxxxxxxxxx> writes:

> Is there any way to specify the alignment of a literal, with
> __attribute__
> ((align ...))

Not as such, no.



> That is to say:
>
> /* wchar_t is 16 bits and 2 byte aligned on this
>   platform; I want 4 byte alignment */
>
> wchar_t *foo = L"...";
>
> The attribute has to go on the literal object, not on foo, obviously.

Perhaps you could write

static wchar_t foo_str[] __attribute__ ((aligned (4))) = L"...";
wchar_t *foo = foo-str;

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux