Connecting Tech Pros Worldwide Help | Site Map

(part 29) Han from China answers your C questions

Nomen Nescio
Guest
 
Posts: n/a
#1: Nov 19 '08
What is this?

Eric said:
Quote:
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

Keith Thompson
Guest
 
Posts: n/a
#2: Nov 19 '08

re: (part 29) Han from China answers your C questions


Nomen Nescio <nobody@dizum.comwrites:
Quote:
What is this?
>
Eric said:
Quote:
>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) kst-u@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"
Richard Heathfield
Guest
 
Posts: n/a
#3: Nov 20 '08

re: (part 29) Han from China answers your C questions


Keith Thompson said:

<snip>
Quote:
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
Closed Thread