Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | James Kuyper <jameskuyper@verizon.net> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: porting from 32-bit to 64-bit with fine-tooth comb? |
| Date | 2015-04-03 11:21 -0400 |
| Organization | Self |
| Message-ID | <551EB001.5030708@verizon.net> (permalink) |
| References | <8c0baf78-2ed4-4012-8a87-df42391b5e75@googlegroups.com> <mfm6qe$7pf$1@speranza.aioe.org> |
On 04/03/2015 10:07 AM, Lőrinczy Zsigmond wrote:
> An incomplete example:
>
> struct {
> char a;
> short b;
> int c;
> long d;
> long long e;
> void *f;
> } oldstruct;
>
> struct {
> char a;
> char unused1;
> int16_t b;
> int32_t c;
> int32_t d;
> int32_t unused2;
> int64_t e;
> /* wtf? you don't write pointers into a file! */
> int32_t f;
> } newstruct;
Your message needs a lot more words. Your code has only a limited
ability to talk for itself, even with comments included. It would help
to explain the purposes and goals behind the design of oldstruct and
newstruct, or at least how the two struct types are intended to be
related to each other.
Whatever it is that you're trying to do, it cannot be done this way
without a precise (and therefore nonportable) specification of the sizes
of the relevant types "32-bit to 64-bit" isn't sufficient. You're
implying (I think?) that short is 16 bits, long long is 64 bits, and all
of the other types are 32 bits. unused1 and unused2 seem intended to
correspond to unnamed padding in oldstruct; padding that you apparently
don't expect to happen automatically in newstruct. This implies that you
have made some fairly detailed and highly non-portable assumptions about
where padding will occur. You need to specify those assumptions in order
to have anything worth talking about - and it would be worth talking
about only in a forum dedicated to the specific platforms where your
non-portable assumptions are valid.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
porting from 32-bit to 64-bit with fine-tooth comb? mbjorn@y7mail.com - 2015-02-07 15:33 -0800
Re: porting from 32-bit to 64-bit with fine-tooth comb? wssimms@gmail.com - 2015-02-07 16:56 -0800
Re: porting from 32-bit to 64-bit with fine-tooth comb? jt@toerring.de (Jens Thoms Toerring) - 2015-02-08 00:59 +0000
Re: porting from 32-bit to 64-bit with fine-tooth comb? Keith Thompson <kst-u@mib.org> - 2015-02-07 17:22 -0800
Re: porting from 32-bit to 64-bit with fine-tooth comb? jt@toerring.de (Jens Thoms Toerring) - 2015-02-08 01:43 +0000
Re: porting from 32-bit to 64-bit with fine-tooth comb? raltbos@xs4all.nl (Richard Bos) - 2015-02-08 16:16 +0000
Re: porting from 32-bit to 64-bit with fine-tooth comb? Richard Damon <Richard@Damon-Family.org> - 2015-02-07 20:02 -0500
Re: porting from 32-bit to 64-bit with fine-tooth comb? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-02-08 02:18 +0000
Re: porting from 32-bit to 64-bit with fine-tooth comb? Bartc <bc@freeuk.com> - 2015-02-08 11:08 +0000
Re: porting from 32-bit to 64-bit with fine-tooth comb? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2015-02-09 21:20 +0000
Re: porting from 32-bit to 64-bit with fine-tooth comb? Nobody <nobody@nowhere.invalid> - 2015-02-09 21:35 +0000
Re: porting from 32-bit to 64-bit with fine-tooth comb? Lőrinczy Zsigmond <nospam@for.me> - 2015-04-03 16:07 +0200
Re: porting from 32-bit to 64-bit with fine-tooth comb? James Kuyper <jameskuyper@verizon.net> - 2015-04-03 11:21 -0400
Re: porting from 32-bit to 64-bit with fine-tooth comb? Barry Schwarz <schwarzb@dqel.com> - 2015-04-03 09:36 -0700
Re: porting from 32-bit to 64-bit with fine-tooth comb? Lőrinczy Zsigmond <nospam@for.me> - 2015-04-03 19:10 +0200
Re: porting from 32-bit to 64-bit with fine-tooth comb? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2015-04-04 21:05 +0000
Re: porting from 32-bit to 64-bit with fine-tooth comb? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-04-04 23:13 -0700
Re: porting from 32-bit to 64-bit with fine-tooth comb? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2015-04-11 04:19 +0000
Re: porting from 32-bit to 64-bit with fine-tooth comb? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-04-10 23:53 -0700
Re: porting from 32-bit to 64-bit with fine-tooth comb? Richard Damon <Richard@Damon-Family.org> - 2015-04-11 10:54 -0400
Re: porting from 32-bit to 64-bit with fine-tooth comb? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2015-04-11 15:59 +0000
csiph-web