Connecting Tech Pros Worldwide Help | Site Map

(part 29) Han from China answers your C questions

  #1  
Old November 19th, 2008, 05:15 PM
Nomen Nescio
Guest
 
Posts: n/a
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

  #2  
Old November 19th, 2008, 05:45 PM
Keith Thompson
Guest
 
Posts: n/a

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"
  #3  
Old November 20th, 2008, 02:25 AM
Richard Heathfield
Guest
 
Posts: n/a

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: (part 33) Han from China answers your C questions Flash Gordon answers 5 November 22nd, 2008 12:35 AM
Re: (part 21) Han from China answers your C questions Lew Pitcher answers 35 November 21st, 2008 07:25 PM
(part 30) Han from China answers your C questions Borked Pseudo Mailed answers 16 November 20th, 2008 05:55 PM
(part 29) Han from China answers your C questions George Orwell answers 0 November 19th, 2008 04:05 PM