GCC #define for alignment

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

 



Hello,

I have a problem in a memory allocator that acts like Malloc(), where I need to align the result value in the same form as malloc.

I can easily hard code something :-( but I'd rather use some "well known" perhaps ANSI-C #define for the alignment value.
It could be a GCC specific #define :-( but I'd rather it not be.

Simply put, for portability reasons I'd rather not have a hard coded thing like this:

   // ensure proper machine alignment
   x = (x + 3) & (~3);

Suggestions? Sure I could use sizeof(void *) also..

-Duane.



[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