c++ - custom alignment (__declspec(align))
- Alexander (4/4) Jan 24 2009 Hello,
- Walter Bright (2/4) Jan 24 2009 http://www.digitalmars.com/ctg/pragmas.html#pack
- Sergey (6/11) Jan 26 2009 As far as I understood the documentation this pragma sets alignment for
- Walter Bright (4/8) Jan 26 2009 There's currently no way to do it statically, as segments themselves are...
- Sergey (4/13) Jan 27 2009 Is it in the plans to get that fixed ?
- Cesar Rabak (4/20) Jan 27 2009 Just for a better grasp on the issue: why is there any need to "fix"
- Sergey (5/27) Jan 28 2009 Well, yes, sorry for putting it wrong,
- Walter Bright (2/3) Mar 05 2009 Not in the near future.
Hello, Is there a way to specify custom alignment for structures and variables, something like __declspec(align(<alignment>)) ? Thanks.
Jan 24 2009
Alexander wrote:Is there a way to specify custom alignment for structures and variables, something like __declspec(align(<alignment>)) ?http://www.digitalmars.com/ctg/pragmas.html#pack
Jan 24 2009
As far as I understood the documentation this pragma sets alignment for members only, but not instances of that struct or class. For example, how would I declare an int variable, which would appear at 128 byte aligned address ? Thanks. Walter Bright wrote:Alexander wrote:Is there a way to specify custom alignment for structures and variables, something like __declspec(align(<alignment>)) ?http://www.digitalmars.com/ctg/pragmas.html#pack
Jan 26 2009
Sergey wrote:As far as I understood the documentation this pragma sets alignment for members only, but not instances of that struct or class. For example, how would I declare an int variable, which would appear at 128 byte aligned address ?There's currently no way to do it statically, as segments themselves are aligned on 16 byte boundaries. You could do it dynamically by allocating a chunk of memory and picking a 128 byte aligned piece of it.
Jan 26 2009
Walter Bright wrote:Sergey wrote:Is it in the plans to get that fixed ? Thanks, Sergey.As far as I understood the documentation this pragma sets alignment for members only, but not instances of that struct or class. For example, how would I declare an int variable, which would appear at 128 byte aligned address ?There's currently no way to do it statically, as segments themselves are aligned on 16 byte boundaries. You could do it dynamically by allocating a chunk of memory and picking a 128 byte aligned piece of it.
Jan 27 2009
Sergey escreveu:Walter Bright wrote:Just for a better grasp on the issue: why is there any need to "fix" such a thing? IMNHO this is not a fault or defect of the compiler, or is it?Sergey wrote:Is it in the plans to get that fixed ? Thanks, Sergey.As far as I understood the documentation this pragma sets alignment for members only, but not instances of that struct or class. For example, how would I declare an int variable, which would appear at 128 byte aligned address ?There's currently no way to do it statically, as segments themselves are aligned on 16 byte boundaries. You could do it dynamically by allocating a chunk of memory and picking a 128 byte aligned piece of it.
Jan 27 2009
IMNHO this is not a fault or defect of the compiler, or is it?Well, yes, sorry for putting it wrong, Anyway, Is this feature going to be implemented any time soon ? Thanks. Cesar Rabak wrote:Sergey escreveu:Walter Bright wrote:Just for a better grasp on the issue: why is there any need to "fix" such a thing? IMNHO this is not a fault or defect of the compiler, or is it?Sergey wrote:Is it in the plans to get that fixed ? Thanks, Sergey.As far as I understood the documentation this pragma sets alignment for members only, but not instances of that struct or class. For example, how would I declare an int variable, which would appear at 128 byte aligned address ?There's currently no way to do it statically, as segments themselves are aligned on 16 byte boundaries. You could do it dynamically by allocating a chunk of memory and picking a 128 byte aligned piece of it.
Jan 28 2009
Sergey wrote:Is this feature going to be implemented any time soon ?Not in the near future.
Mar 05 2009