| Thread overview | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
January 24, 2009 custom alignment (__declspec(align)) | ||||
|---|---|---|---|---|
| ||||
Hello, Is there a way to specify custom alignment for structures and variables, something like __declspec(align(<alignment>)) ? Thanks. | ||||
January 24, 2009 Re: custom alignment (__declspec(align)) | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Alexander | 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 | |||
January 26, 2009 Re: custom alignment (__declspec(align)) | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | 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
| |||
January 27, 2009 Re: custom alignment (__declspec(align)) | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Sergey | 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.
| |||
January 27, 2009 Re: custom alignment (__declspec(align)) | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | Walter Bright wrote:
> 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.
Is it in the plans to get that fixed ?
Thanks,
Sergey.
| |||
January 27, 2009 Re: custom alignment (__declspec(align)) | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Sergey | Sergey escreveu:
> Walter Bright wrote:
>> 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.
>
>
> Is it in the plans to get that fixed ?
>
> Thanks,
> Sergey.
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?
| |||
January 28, 2009 Re: custom alignment (__declspec(align)) | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Cesar Rabak | > 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:
>>> 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.
>>
>>
>> Is it in the plans to get that fixed ?
>>
>> Thanks,
>> Sergey.
> 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?
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply