473,387 Members | 1,464 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

(part 29) Han from China answers your C questions

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
2 2177
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Nomen Nescio | last post by:
A new learner's question Flash Gordon wrote: To the OP, please be aware that Flash Gordon has a history of either deliberately misleading and "miss-informing" posters to this newsgroup or...
0
by: Nomen Nescio | last post by:
what is the type for this call? Neo said: Neo, buddy, I've decided to give you a little summary for reference so that you don't have to sift through excess verbiage, cryptic meanderings,...
0
by: Nomen Nescio | last post by:
No format string passed to variable argument list function Adam said: Then Adam laters says: Then Adam later says:
2
by: Chris Dollin | last post by:
Joachim Schmitz wrote: I think that remark is an ill-considered and unhelpful generalisation. -- "We dance, and the worlds melt away." - Curved Air, /Metamorphosis/ ...
2
by: Borked Pseudo Mailed | last post by:
float and integers c.lang.myself@gmail.com said I will be making assumptions here about your system that will infuriate the pedants, but I don't care. Given your X-HTTP-UserAgent string, it...
1
by: George Orwell | last post by:
its urgent.pls help me. mona said: mona said: Hey again, mona. Please check the thread "(part 21) Han from China answers your C questions", in which I gave you a program with
0
by: George Orwell | last post by:
fread breaks file descriptors opened in "w" mode. ... Yes, once you break out of ANSI/ISO C, all things are possible. You have posted an on-topic question to comp.lang.c. See version 2.0 of...
16
by: Borked Pseudo Mailed | last post by:
Error handling in C Nick Keighley said: ... ... To the OP, please be aware that Nick Keighley is a known troll and is deliberately providing you with unsound advice. You asked for error...
1
by: George Orwell | last post by:
File Seeking / Overwriting bytes Martien Verbruggen said: And this is, of course, also not right. fseek() does support SEEK_END on text streams. If you want to know why, please start a...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.