9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] 8c padding problem
Date: Fri, 21 Dec 2007 19:20:26 -0500	[thread overview]
Message-ID: <d6c1331c41a97e88c9db8a5d54d2a1d8@quanstro.net> (raw)
In-Reply-To: <8ea9211edc9a0cad52683bcd6ae3f64d@9netics.com>

> but it doesn't have to be.  this is legit:
> 
> 	typedef struct{
> 		Ehdr;		// 1
> 		Ehdr;		// 2
> 		uchar	op[2];
> 	}Pkt;

my explinations stink.  perhaps this gets at what
i'm saying better.  the structure S0 won't have
any padding, yet the two calls to frobehdr are
just fine.  i'm not sure i see the alignment problem
that requires padding all unnamed structures.

	typedef struct{
		uchar	s[6];
		uchar	d[6];
		uchar	t[2]
	}Ehdr;

	frobehdr(Ehdr*)

	typedef struct{
		uchar	s0[6];
		uchar	d0[6];
		uchar	t0[2]
		uchar	s1[6];
		uchar	d1[6];
		uchar	t1[2]
	}S0;

	void
	thunk0(void)
	{
		S0 *s;
		frobehdr((Ehdr*)s->s0);
		frobehdr((Ehdr*)s->s1);
	}


- erik


  reply	other threads:[~2007-12-22  0:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-21 23:10 erik quanstrom
2007-12-21 23:24 ` Martin Neubauer
2007-12-22  0:00   ` erik quanstrom
2007-12-21 23:48 ` Skip Tavakkolian
2007-12-21 23:52   ` erik quanstrom
2007-12-21 23:59     ` Skip Tavakkolian
2007-12-22  0:20       ` erik quanstrom [this message]
2007-12-22  4:25         ` Bruce Ellis
2007-12-22  4:34           ` erik quanstrom
2007-12-22  4:41             ` Bruce Ellis
2007-12-22 11:09   ` C H Forsyth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d6c1331c41a97e88c9db8a5d54d2a1d8@quanstro.net \
    --to=quanstro@quanstro.net \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).