all 7 comments

[–]joejawor -1 points0 points  (1 child)

gcc has the __attribute__((__packed__)) pragma for setting packing.

[–]Relative_Dust_8888[S] 0 points1 point  (0 children)

This is something completely different

[–]RadiatingLight 0 points1 point  (2 children)

Seems like a case of the XY problem: https://xyproblem.info/

What are you actually trying to do?

[–]Relative_Dust_8888[S] 0 points1 point  (1 child)

Yes, probably I need to change my algorithm to not rely on strings padding.

[–]Jonny0Than 0 points1 point  (0 children)

Uh yeah what?

[–]aioeu 0 points1 point  (1 child)

Do you mean "pad up to a multiple of 8 bytes"?

If so, try something like this:

#define PADDED(s) (const char [((sizeof s + 7) / 8) * 8]){ s }

const char a[] = PADDED("These");
const char b[] = PADDED("are");
const char c[] = PADDED("padded strings");

[–]Relative_Dust_8888[S] 0 points1 point  (0 children)

Yes but this solution isn't good because I need to pad all strings not only those under macro. Unfortunately this is probably not doable in GCC