Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Hans-Bernhard Bröker <HBBroeker@t-online.de> |
|---|---|
| Newsgroups | comp.std.c |
| Subject | Re: Structure Packing. |
| Date | 2012-06-12 18:37 +0200 |
| Message-ID | <a3p9irFkgbU1@mid.dfncis.de> (permalink) |
| References | <12b3df42-f6a0-4411-a5e5-136900f8255b@googlegroups.com> <jqovin$9sr$1@dont-email.me> <4FD6ABFA.72F52C75@bytecraft.com> <jr7fpp$eti$1@dont-email.me> <4FD7659E.89172310@bytecraft.com> |
On 12.06.2012 17:51, Walter Banks wrote: > I have resolved every issue in this specific processor except memcpy > and memcmp both of which are rarely used in embedded systems. I rather doubt the correctness of that assessment. And even if it were correct, "rarely used" would not help you --- you would need "never used". For tricks like the one you're considering to be viable, you would have to intercept not just every call of memcpy(), but worse, every single one of the roll-your-own implementations of it hidden somewhere in the code --- including those that aren't even written in C to begin with. Danger, Will Robinson! Sticking unrelated statics into the padding gaps might be viable for struct constants kept in ROM, but there's really no reliable way that can work in struct variables. > I am uncomfortable even with packing the struct elements out of > order. You should be more than uncomfortable --- that's actually disallowed by the standard. To quote C99 6.7.2.1#16: > Within a structure object, the non-bit-field members and the units in which bit-fields > reside have addresses that increase in the order in which they are declared.
Back to comp.std.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Structure Packing. John Kearney <dethrophes@googlemail.com> - 2012-06-06 17:27 -0700
Re: Structure Packing. James Kuyper <jameskuyper@verizon.net> - 2012-06-06 21:19 -0400
Re: Structure Packing. Walter Banks <walter@bytecraft.com> - 2012-06-11 22:39 -0400
Re: Structure Packing. Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-12 09:21 -0400
Re: Structure Packing. Walter Banks <walter@bytecraft.com> - 2012-06-12 11:51 -0400
Re: Structure Packing. Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2012-06-12 18:37 +0200
Re: Structure Packing. Walter Banks <walter@bytecraft.com> - 2012-06-12 15:06 -0400
Re: Structure Packing. Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-12 16:22 -0400
Re: Structure Packing. Walter Banks <walter@bytecraft.com> - 2012-06-12 17:44 -0400
Re: Structure Packing. Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2012-06-13 15:53 +0200
Re: Structure Packing. Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2012-06-18 12:37 +0300
Re: Structure Packing. Martin Shobe <martin.shobe@yahoo.com> - 2012-06-12 16:22 +0000
Re: Structure Packing. Walter Banks <walter@bytecraft.com> - 2012-06-12 15:24 -0400
Re: Structure Packing. Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-12 16:33 -0400
Re: Structure Packing. Walter Banks <walter@bytecraft.com> - 2012-06-12 17:17 -0400
Re: Structure Packing. Keith Thompson <kst-u@mib.org> - 2012-06-06 18:35 -0700
Re: Structure Packing. John Kearney <dethrophes@googlemail.com> - 2012-06-06 21:58 -0700
Re: Structure Packing. Keith Thompson <kst-u@mib.org> - 2012-06-06 23:54 -0700
Re: Structure Packing. John Kearney <dethrophes@googlemail.com> - 2012-06-07 07:47 -0700
Re: Structure Packing. James Kuyper <jameskuyper@verizon.net> - 2012-06-07 12:39 -0400
Re: Structure Packing. jacob navia <jacob@spamsink.net> - 2012-06-07 11:14 +0200
Re: Structure Packing. Keith Thompson <kst-u@mib.org> - 2012-06-07 09:46 -0700
Re: Structure Packing. John Kearney <dethrophes@googlemail.com> - 2012-06-07 11:57 -0700
csiph-web