By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,434 Members | 1,878 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,434 IT Pros & Developers. It's quick & easy.

(part 29) Han from China answers your C questions

P: n/a
What is this?

Eric said:
What is this?

( char * ) &( ( struct aStruct * ) 0 )
That looks like either someone's poor coding or someone's poor
pasting for an implementation of offsetof() from stddef.h. The
(char *) leads me to think that there's plenty of missing context,
so post the surrounding code, and we'll be happy to jerk ourselves
off analyzing the code for you and telling you why it won't work on
the control system for your Tomahawk missile.

For what it's worth,

((size_t) &((TYPE *)0)->MEMBER)

is a common implementation of offsetof() on systems that allow it.

Yours,
Han from China

Nov 19 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Nomen Nescio <no****@dizum.comwrites:
What is this?

Eric said:
>What is this?

( char * ) &( ( struct aStruct * ) 0 )

That looks like either someone's poor coding or someone's poor
pasting for an implementation of offsetof() from stddef.h. The
(char *) leads me to think that there's plenty of missing context,
so post the surrounding code, and we'll be happy to jerk ourselves
off analyzing the code for you and telling you why it won't work on
the control system for your Tomahawk missile.

For what it's worth,

((size_t) &((TYPE *)0)->MEMBER)

is a common implementation of offsetof() on systems that allow it.

Yours,
Han from China
"Han from China", or "Nomen Nescio", or whoever you are:

You seem to know C pretty well, and I've seen you make some valid
points. Perhaps if you gave up on the trolling (e.g., post under a
consistent name (it doesn't have to be your real one), don't start a
new thread for every followup, and stop being such an offensive jerk),
you might actually make a valuabe contribution here. It's up to you.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Nov 19 '08 #2

P: n/a
Keith Thompson said:

<snip>
Perhaps if you gave up on the trolling (e.g., post under a
consistent name (it doesn't have to be your real one), don't start a
new thread for every followup, and stop being such an offensive jerk),
you might actually make a valuabe contribution here. It's up to you.
If he were even remotely interested in making a valuable contribution, he
would do so. Like the other trolls, he's only interested in seeing how
many people he can wind up. The only reason that it's tempting to try to
persuade such people to behave reasonably is that you yourself are a
reasonable person - such persuasion would work on you, were it necessary,
so you assume it will work on them, too.

Once you realise that such people are not reasonable, you will find it
easier to deal with them.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Nov 20 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.