All of lore.kernel.org
 help / color / mirror / Atom feed
From: _z33 <timid.Gentoo@gmail.com>
To: linux-c-programming@vger.kernel.org
Subject: Re: any compelling reasons to use "offsetof"?
Date: Fri, 19 Aug 2005 11:16:44 +0530	[thread overview]
Message-ID: <de3rgv$72p$1@sea.gmane.org> (raw)
In-Reply-To: <Pine.LNX.4.63.0508181019570.10814@localhost.localdomain>

Robert P. J. Day wrote:
>   in a legacy project i just inherited, i did a quick recursive grep
> and noticed a number of invocations of "offsetof".  from experience,
> i've concluded that the majority of these calls are because of sloppy
> programming or laziness or just plain doing something incredibly hacky
> that could be done in a more straightforward way.
> 
>   are there any really compelling reasons to need to know the offset
> of a structure field?  just curious.
> 
I don't much about that macro. Anyway I came across a couple of articles 
from which I have a vague idea of why it is used.
<http://www.cepba.upc.es/docs/sgi_doc/SGI_Developer/books/CLanguageRef/sgi_html/ch01.html>
<http://www.freshsources.com/19950054.HTM>
Mostly, if the project is of ANSI standard, then it is just there for 
standards compliance. Otherwise, the macro is used for the reasons 
mentioned here in this article 
<http://www.embedded.com/showArticle.jhtml?articleID=18312031>.


_z33
-- 
I love TUX; well... that's an understatement :)


  reply	other threads:[~2005-08-19  5:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-18 14:21 any compelling reasons to use "offsetof"? Robert P. J. Day
2005-08-19  5:46 ` _z33 [this message]
2005-08-19  9:36 ` Glynn Clements

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='de3rgv$72p$1@sea.gmane.org' \
    --to=timid.gentoo@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.