 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
abhivg Guest
|
Posted: Mon May 21, 2007 9:10 am Post subject: Structure padding warnings when porting to 64 bit |
|
|
Hi,
I am trying to port a 32 bit Unix application to 64 bit Windows. While
compiling on Windows I am getting a number of warnings related to
structure padding.
More specifically "warning C4820: 'seqargs' : '4' bytes padding added
after data member 'stop_codon_pos'"
Assuming that there is no pointer arithmetic being done on these
structures, is it ok to safely ignore this warning?
Abhishek |
|
| Back to top |
|
 |
Erik Wikström Guest
|
Posted: Mon May 21, 2007 9:10 am Post subject: Re: Structure padding warnings when porting to 64 bit |
|
|
On 21 Maj, 08:13, abhivg <abhi...@gmail.com> wrote:
| Quote: | Hi,
I am trying to port a 32 bit Unix application to 64 bit Windows. While
compiling on Windows I am getting a number of warnings related to
structure padding.
More specifically "warning C4820: 'seqargs' : '4' bytes padding added
after data member 'stop_codon_pos'"
Assuming that there is no pointer arithmetic being done on these
structures, is it ok to safely ignore this warning?
|
This is probably better answered in a groups dedicated to your
compiler/platform, see the FAQ for suggestions:
http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.9
As to your question, it's hard to tell, pointer arithmetic on the
structs themselves will probably be fine, since the compiler knows how
large the struct is. The problems that might arise is if an offset
from the address of the struct is used to access a member. Notice that
this error message would not appear if there weren't some statements
about the alignment of the struct or members thereof and I'll have to
assume that there's some reason for that (though it does not have to
be a good one).
You might want to read the documentation about the warning:
http://msdn2.microsoft.com/en-us/library/t7khkyth(vs.80).aspx
--
Erik Wikström |
|
| Back to top |
|
 |
abhivg Guest
|
Posted: Mon May 21, 2007 9:11 am Post subject: Re: Structure padding warnings when porting to 64 bit |
|
|
On May 21, 12:18 pm, Erik Wikström <eri...@student.chalmers.se> wrote:
| Quote: | On 21 Maj, 08:13, abhivg <abhi...@gmail.com> wrote:
Hi,
I am trying to port a 32 bit Unix application to 64 bit Windows. While
compiling on Windows I am getting a number of warnings related to
structure padding.
More specifically "warning C4820: 'seqargs' : '4' bytes padding added
after data member 'stop_codon_pos'"
Assuming that there is no pointer arithmetic being done on these
structures, is it ok to safely ignore this warning?
This is probably better answered in a groups dedicated to your
compiler/platform, see the FAQ for suggestions:http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.9
As to your question, it's hard to tell, pointer arithmetic on the
structs themselves will probably be fine, since the compiler knows how
large the struct is. The problems that might arise is if an offset
from the address of the struct is used to access a member. Notice that
this error message would not appear if there weren't some statements
about the alignment of the struct or members thereof and I'll have to
assume that there's some reason for that (though it does not have to
be a good one).
You might want to read the documentation about the warning:http://msdn2.microsoft.com/en-us/library/t7khkyth(vs.80).aspx
--
Erik Wikström
|
Thanks for replying Erik,
By pointer arithmetic, I meant addition of pointers with offsets
(magic numbers). So besides use of pointers and hardcoded offsets, is
there any area where padding might be a problem?
| Quote: | From what I understood, structure padding is done by the compiler
mainly to speed up memory access. |
Sorry about posting my question in the wrong group. Will remember that
from now on.
regards,
Abhishek |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|