linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jan Smout" <jan.smout@gmail.com>
To: Giulio Rossato <giulio.rossato@infocamere.it>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: offsets of fields in a structure
Date: Fri, 19 Oct 2007 21:50:14 +0200	[thread overview]
Message-ID: <7dde11ce0710191250t58493199ka61cde50a27cb6e7@mail.gmail.com> (raw)
In-Reply-To: <4718CCE2.9060202@infocamere.it>

On 19/10/2007, Giulio Rossato <giulio.rossato@infocamere.it> wrote:
> I want write a function that receives as parameters a start address and
> a "description of a structure" and returns the offsets of the fields.
> The structure is not known at compile time. The offsets should be
> calculated at runtime and the code should be independent of the machine.
> How should be written this function?

Have a look at the Linux manpage for the "offsetof(type,
member)"-macro from stddef.h. It will probably not be exactly what
you're looking for, but might be a starting point which gets you
going.

Jan

      parent reply	other threads:[~2007-10-19 19:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-19 15:27 offsets of fields in a structure Giulio Rossato
2007-10-19 16:30 ` ninjaboy
2007-10-19 17:35 ` LaPoint, Adam W
2007-10-19 18:07   ` LaPoint, Adam W
2007-10-19 18:11 ` Glynn Clements
2007-10-19 19:50 ` Jan Smout [this message]

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=7dde11ce0710191250t58493199ka61cde50a27cb6e7@mail.gmail.com \
    --to=jan.smout@gmail.com \
    --cc=giulio.rossato@infocamere.it \
    --cc=linux-c-programming@vger.kernel.org \
    /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).