R
Richard Heathfield
Roose said:[...] the point is communication, not rigid technical definitions.
It is to facilitate effective communication that the rigid technical
definitions exist in the first place.
Roose said:[...] the point is communication, not rigid technical definitions.
to it in the index to the 2nd Edition....
Whereas Roose's explanation of "object" wasn't quite as useful as the one
above, I was very much attracted to his ideas about anchoring the abstract
in the real world of cpu registers and such.
Perhaps it wouldn't be a bad idea to learn a little assembly language at
this point?
May I also point out that quoting the ANSI standard to a novice is about
as useful as replying in Swahili![]()
Roose said:Give me a break.
This is EXACTLY why CLC should not be just about standard C,
and CLC.moderated should have that sole responsibility.
Regardless of
whether they're right for coming here, there are TONS of newbies that do.
Agreed.
And then they get these rigid, exacting answers
filled with irrelevant technical details,
which you would never hear in the real world.
Then they
get turned off to C and think it's for wankers.
A LOT of people actually think this.
I don't doubt that you are technically correct.
Just like I didn't in the interview thread.
Wonderful.
But your insistence on expounding on all these
trivialities
obscures the real question. Getting a job, or learning how
to write a real program that does what you want it to do.
It may technically, but not in colloquial usage.
If you start blathering
about objects in C at work, some people will be confused, and others might
wonder why you're being such a pedant.
Some people might think you're
talking about objective C, or C++, or emulating object-orientation in C,
etc.
Maybe for understanding the C standard. It is not vital for those who
simply wish to write successful programs,
me being an example of that.
Alan said:The concept of "object" is much clearer. (as are local battlelines
I do wonder why K&R didn't find it important enough to include a reference
to it in the index to the 2nd Edition....
May I also point out that quoting the ANSI standard to a novice is about
as useful as replying in Swahili![]()
Thanks again, Richard.
Roose said:In C, there is no technical term "object", [snip]
Roose said:I know you still hold a grudge [crap snipped]
Please don't top-post.Roose said:I meant "C" of course, not "C++". [crap "of course" snipped]
well it sounds simple enough, but I've heard so many things about
pointers that I thought it will be a good idea to get a book just
about pointers but I guess C books have pointer references in them as
well.
but I'll take your advice and ask here if I have more questions.
Roose said:Actually, it's best done by giving someone something to _do_, rather then
telling them information. Which is what I did.
Information that isn't relevant only confuses. Besides, the term object is
just a name, i.e. your statement is a synthetic fact (as opposed an
analytic). If you don't know what I mean, go read some philosophy.
I
didn't know what an object is in C until now, and I have programmed
successfully for many years, shipped many products, etc. It doesn't matter.
Nobody has ever learned anything by reading a bunch of facts. They learn by
doing. If the OP does what I told him to do successfully, he will have gone
A LOT farther toward being a professional programmer in C then if simply
reads all of the "definitions" post.
That's better for you. Not better for a newbie. I would love to see some
beginner ask you about C programming, and you start blathering on about
lvalues.
..."insular little world of the C standard as a bible" ...
Damn I keep hearing echoes of my earlier posts again...
Sheldon said:Apparently you have read the book. Tell me, do the words "far pointer"
and "near pointer" appear in the book? If so, don't read the book.
Sure. Take a break, any time you like.
In comp.lang.c.moderated, I suspect that many of your articles would simply
not be approved by the moderator. Feel free to try to prove me wrong.
You may consider the details irrelevant. I do not, however, pitch my answers
at your level of understanding, but at the questions actually asked by real
people. When the details matter, I give the details. When they don't, I
don't. Now, you may have considered my answer to be overly technical, but
it's a walk in the park compared to the answer I /could/ have given. I
included as much detail as I considered the OP could reasonably be expected
to take in (in one sitting), together with a little encouragement that it
really isn't as hard as he's been led to believe. I continue to maintain
that this was an appropriate response to his question.
Well, actually, I do discuss such (relevant) technical details in the real
world, as well as on Usenet. And anyway, what makes you think that Usenet
is not part of the real world?
Speculation. I've found that people often respond well to being told the
underlying truth, rather than the helicopter-joystick method of
programming: "fiddle with the program, and watch what the computer does,
because if you want it to do that again, that is the code you have to
write" is not a very satisfactory way to learn programming.
That wasn't the real question. The real question was about pointers.
Then colloquial usage is wrong, and should be changed.
If one wishes to write /correct/ C programs, an understanding of the
principles laid out in the Standard is vital. The easiest way to achieve
this understanding is by reading and understanding the C Standard.
And whats wrong with learning the techncal words that help define the
language you're using? The concept of an lvalue is very useful in C.
Not to be redundant, but this is probably because it is not common in
colloquial usage among C programmers. It probably exists to give compiler
writers a convenient term for a general idea, which the regular C programmer
needn't be concerned with.
I'm glad you found it useful.
That might help, but you don't even need to learn a specific machine. You
can have a quite simplified model of what assembly language is and it will
be helpful in C programming. After all, it is different for each machine,
so you don't want to have _too_ specific an idea.
Basically you have a CPU which has a clock say every microsecond if you're
on a gighertz machine.
are stored in 32 bits in a binary format). Pretend it is a big array of
bytes. You start at the beginning, and just drag through the stream. They
are executed as fast as possible on these discrete clock ticks. Some
instructions take more cycles than others. Adds are cheap (say they take 1
cycle), multiplies a little slower (2 cycles), divides slower (4 cycles).
These are numbers I pulled out of my ass, of course it's different on every
machine.
instructions, more or less. You have floating point and integer
instructions. Character strings are arrays of integers (ASCII). Pointers
are integers as well.
There are instructions to load a word from memory into a CPU register, and
vice versa, to store a word from a CPU register to memory. Note that memory
accesses are much more expensive than arithmetic instructions (pretend 50
cycles on average). All the instructions only work on CPU registers. So to
add to integers in memory, you would have to:
1. load them both from memory to CPU registers
2. execute the add instruction and specify those two registers
3. store the result back to memory
Memory is just a big array of bytes. If you have 1 gig of memory, pretend
it is addressed 0 .. 0x3FFFFFFF. This is 2^30-1, or 1 gig. 0xFFFFFFFF is
2^32-1, which means 4 gigs. If you have heard Apple's stupid advertisements
that you can have more than 4 gigs of RAM in their PCs, that is because they
use more than 32 bits for pointers (i.e. the G5's 64-bit).
Also, you know that if's and goto's can be substituted for all for and while
loops.
Loops are just a convenient abstraction. On the machine, they are
all implemented in terms of if's and goto's (called jumps in assembly
language, you jump from one instruction to another than is not sequential).
So basically the CPU drags through the instructions sequentially, until it
hits a jump instruction.
If you want to know about I/O, you'll have to learn about interrupts and
such,
and I'll stop here because that is more than enough to absorb.
(Note: nitpickers will be flamed. I _know_ for a fact these things are not
all true on every machine, but is a convenient model, in the interest of
giving something _concrete_, again)
Indeed.
Roose
No. You provided incorrect information and got defensive when you were
corrected.
In order to dicuss something you first have to get the terms right. If
you don't know what I mean, follow your own advice and go read some
philosophy.
Hopefully I never have to use one of those products.
Reread the thread: the poster asked for the definition of the term
"object" in the context of the C language. Why not answer his question
instead of gibbering?
[...]Roose said:Basically you have a CPU which has a clock say every microsecond if you're
on a gighertz machine.
So memory is just dumb storage. I didn't realize that.
Don't get THAT at all, but that's okay for now.
Wouldn't that be "nanosecond"?
So memory is just dumb storage. I didn't realize that.
Don't get THAT at all, but that's okay for now.
In your previous post you recommended that I learn hexadecimal (which I
have a slight handle on: 0-9-F with one character to describe identify
a nibble.
By this you mean learning to convert it to decimal, right?
I do?
Sounds like the b command in sed. (oops! The b command in sed must be
like the jump instruction in C![]()
Singe the hair off their balls: I'm getting a lot out of this.
It's really hard to learn the basics of anything if you get too bogged down
in exactness.
Roose said:Not to be redundant, but this is probably because it is not common in
colloquial usage among C programmers.
Richard Heathfield said:Yes, a typo, already corrected elsethread. No, I didn't notice it myself.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.