"Mastering C Pointers"....

I

Irrwahn Grausewitz

Joona I Palaste said:
(e-mail address removed) scribbled the following:


What in the bloody blazes are you babbling about? You make it sound like
we have some sort personal vendetta against Roose, and would assault him
*in real life* if we ever met him. You must have us confused with the
mafia.

<OT humor(?)>

But Joona, c.l.c /is/ the mafia, look at some of the names (picked
randomly, in no particular order):

Dan "Don" Pop
Richard "The Voice" Heathfield
Joona "Joker" I Palaste
Chuck "Berserk" Falconer
Nobody "Nobody" Nobody
Chris "The Rule" Torek
Mike "Smiley" Wahler
Default "Nuke'm" User
James "Brains" Kuyper
Irrwahn "Germ" Grausewitz
...
[ continue at will ;-) ]

</OT humor(?)>

Damn, didn't I promise to not post further in this thread? Oh, too
late, too late ...
 
D

Default User

Alan said:
Why do you assume that I lack both eyes and common sense?

Your behavior.
Richard and a few others have done almost nothing but attack Roos since
the thread began.
Untrue.

That's the only troll-like behavior I have seen here.

I'm not 100% sure, but it's possible that you and "Roose" are the same
person. Maybe, maybe not. However, if not, your lack of sense and
continued attack on respected members of the newsgroup have earned you
this, along with "Roose":


*plonk*




Brian Rodenborn
 
R

Roose

Yes, I'd be quite curious to think what might happen... : ) Are they going
to come over my house and bother me about standard C? The world of C is
quite large, and I work in commercial software development, and it is
doubtful that many here do. Their tendencies seem to skew them toward
rejecting that world.
 
I

Irrwahn Grausewitz

Default User said:
Alan is actually correct about that. As the .sig has a couple blank
lines in it, it could be brought up to code with no loss of content.




Brian Rodenborn

As your post contains several excess blank lines and lacks a proper
signature delimiter, it could be bro~~~*"%c$")"ss/%- <No Carrier>
;-))
 
A

Alan Connor

*cackle*

--
Randy Howard _o
2reply remove FOOBAR \<,
______________________()/ ()______________________________________________
SCO Spam-magnet: (e-mail address removed)

I really don't like watching people masturbate in public.

Killfiled for 60 days.
 
R

Richard Heathfield

Whether you like it or not Richard H, et. al. are well respected and
influential C programmers

It's kind of you to say that.
and are willing to use this respect and
influence to smack other people down when they see fit.

That's not so kind, and it's not true either. I am, however, willing to use
/logic/ in the course of discussions in this newsgroup. Influence and
respect are fine things to have, but those who abuse respect will soon lose
it.
You cannot win. You will only harm yourself. They will not stop.

Well, I don't see any reason to stop posting corrections to errors if I
happen to notice them. Nor do I see any reason for other people to stop
posting corrections to /my/ errors. Error correction is part and parcel of
the culture of this newsgroup (and it shares that in common with several
other newsgroups that I know of, so I don't see a big deal here).
 
A

Alan Connor

Uh, I'm not exactly sure what a symlink is, but if it is anything like a
Windows shortcut, there is definitely an analogy there.

I believe so. But it's probably more accurate to call a symlink/shortcut
a pointer :)

[ Symlink: I have a file named foo in my home directory. There's nothing
there but the name (size 3 bytes, say), yet when I open it in a pager, a
4kb file is there, and it's actual location is a completely different
directory and it has a completely different name. ]

The windows shortcut just stores the location of a file. A "pointer" to it.
An address. The address is the _path name_. In C, the "address" is
basically an integer, indicating where in a huge array of memory the
variable is.

That's it.
You can have as many shortcuts as you want that point to the file. A
shortcut takes a small amount of storage, but not as much as a (typical)
file. You can have whole directories of shortcuts that point to files all
over the place, in order to organize them.

Same for symlinks. They can also point to directory trees.
Likewise, you can have
collections of pointers, that point to various different things _scattered_
all over memory.

Yep.

For example, on my hard disk, I have a whole bunch of (legal) MP3s organized
by artist and by album. Now, some of them were ripped poorly and have
clicks. So I *could* just copy those files to another folder, in order to
note that I need to rip them again.

However, it is *much* easier and efficient to just copy shortcuts those bad
files into another folder -- called "bad". That way I don't duplicate any
data. And I have all the bad files organized in one directory, and can
access them easily.

Indeed. All this stuff is sure a lot easier on Linux/UNIX, though, assuming
the usual bloated inefficiency of Windoze (even if you are running an older
release that still has DOS. (couldn't resist :)

You could do the exact same thing with pointers. Suppose I had a whole
bunch of strings in memory, that listed a ton of song names. I could create
an array of pointers called "theBeatles" that pointed to every single song
by the Beatles. Then I could have an array of pointers called "badFiles"
that pointed to all the bad files, _some of which_ may be by the Beatles.
Note that I haven't incurred the storage cost of repeating the strings,
*just* pointers to them. Likewise I could create another array called
"before1960" that points to all songs stored before 1960 -- you get the
idea.

Hm, I'm surprised this didn't come up earlier. This is an easy analogy.

And that's a huge relief. Still a long way from an actual working program,
though...

It would be really nice to see a line-by-line breakdown of everything that
happens from the time you do:

gcc -o 1stprog hello.c

#include <stdio.h>

/* hello.c print "hello world." */

main()

{

printf("\n\n\nHello, WORLD!!\n\n\n");
}


to the appearance of "Hello, WORLD!!" on the screen.

Would it fill a small book? That would be my guess.


(Rubber Soul is one of my favorite all-time song collections.)


The fact that a bunch of obvious jerks don't like you is an extremely
good recommendation in my book, Roose.

Thanks again.
 
M

Mark Gordon

Yes, I'd be quite curious to think what might happen... : ) Are they
going to come over my house and bother me about standard C?

No, but if they recognise you in an interview for a job your posts here
would be held against you. Equally some of mine where I have made
mistakes could be held against me, but I would like to think that I've
not posted anything as bad as some of your advice.
The world
of C is quite large, and I work in commercial software development,
and it is doubtful that many here do. Their tendencies seem to skew
them toward rejecting that world.

Based on a number of things the regulars have posted I can say with
confidence that they have spent a lot of time working on commercial
software. Personally I have 15 years experience working on software in
the defence industry (only 5 of that in C) and about 3.4 years writing
commercial software which is business critical for some large companies
in the UK.

I've also represented both QA and the SW Development manager
at reviews of other peoples work when I worked in the defence industry,
so I know what will be rejected from experience of being the person to
do the rejecting. I've yet to see evidence that SW written by you would
be considered acceptable.

<snip>
 
A

Alan Connor

Well, I can do both : )

schizostylistic ? :)
Well, I was the one who stopped in the previous flamewar (see the thread
about how you tell if a struct is 0, if you haven't seen it)

I'd rather see how far I can shove bamboo splinters under my fingernails,
thank you.

, and that will
likely be the case here.

It's all in good fun. I enjoy a good argument. Richard is at least fun to
argue with, because he grasps basic ideas and arguments (unlike some already
noted, who fail to understand the basic line, and respond with lame insults,
and who I *don't* respond to). Unfortunately, when you corner him, he
resorts to children's games, or simply refuses to answer, and then I stop.
No more fun then.

Exactly. And none of it is very interesting to a novice, who has to wonder
whether the participants are distorting the truth in order to 'win' the
argument...

In all seriousness, I just don't trust the Richard fellow at this point,
in spite of his obvious expertise.
 
R

Richard Heathfield

Alan said:
In all seriousness, I just don't trust the Richard fellow at this point,
in spite of his obvious expertise.

Please point out the aspect of C on which you think I have sought to mislead
people.
 
J

Joona I Palaste

Please point out the aspect of C on which you think I have sought to mislead
people.

You're playing childish word games again, Richard. (Did I do this
right?)
 
R

Richard Heathfield

Joona said:
You're playing childish word games again, Richard. (Did I do this
right?)

You have correctly misinterpreted a perfectly ordinary and unexceptional
statement as a childish word game. Yes, I think you've more or less got the
right idea.
 
R

Randy Howard

Great. I get killfiled (oh no!) for laughing at the obvious joke RJH was
referring to, with respect to Ritchie and topicality.

So be it.
 
J

Joona I Palaste

Great. I get killfiled (oh no!) for laughing at the obvious joke RJH was
referring to, with respect to Ritchie and topicality.
So be it.

You mean the time RJH told Dennis Ritchie he (DMR, not RJH) was off
topic? Yes, that really happened.
Reply written primarily to let Roose and/or Connor know what the irony
was. With any luck at least one of them has not killfiled me yet.
(Although I've killfiled both.)
 
R

Randy Howard

The world of C is quite large,

Yet you seem to have an extremely narrow view of it. Quite
a contradiction.
and I work in commercial software development

So do a large number people, with widely varying degrees of success.
and it is doubtful that many here do.

You really are delusional if you think that is the case.
Their tendencies seem to skew them toward rejecting that world.

How so?

Consider that it is extremely difficult to develop large scale
programs that remain entirely within the ISO C sandbox. That is
true in general. Exceptions probably exist. That isn't the point.

Accepting that to be the case, it is still possible to construct
such programs in a fashion where the bulk of the code is portable
and isolate that platform- and compiler-dependent portions into
separate modules and mark them clearly as such.

I have certainly found this to be a very useful tactic on large
development efforts. It isn't particularly difficult, it allows
for other portable modules to be re-used without having to
"factor out" the platform-specific garbage and porting times can
be extremely short, in some cases hours or even minutes.

This group is basically focused on how to best develop code that
fits the ~95% portion of such programs that are inherently portable
and minimizing the amount of code which needs to be handled in a
non-standard way (and which is discussed elsewhere, where it is
more appropriate).

As a concrete example, I have developed and actively maintain a
particular suite of software tools and applications that must
execute properly on Win/95, Win/98, Win/ME, NT4, W2K, Win/XP (all
32-bit), Win64 (AMD and Itanium), RedHat, SuSE, Caldera, TurboLinux,
Mandrake, etc. of various releases back several years on 32-bit and
64-bit hardware platforms, along with several different proprietary
UNIX platforms as well as Novell NetWare 5.1, 6.0 and 6.5.

That is done with a code base that is 95% or more straight ISO C
with a few platform specific modules that allow the bulk of the
other code to operate as if only one architecture was supported. It
did take a lot of work, ONE TIME, to get the structure for that
working properly. The ports to a new environment are usually
quite easy, although it didn't appear easy when I first started
the project.

Not every source file will compile in strictly conforming mode,
but the vast majority of them do, and they don't need ANY
modifications when moving to a new platform.

I don't think that is particularly magic, as I'm quite sure a
large number of the regulars here do the same kind of thing on
a regular basis. The point is, they don't feel compelled to
confuse the waters with the "tricky bits" that aren't part of
the standard as those portions are better dealt with in a
newsgroup focused on the particular extension in question.
 
K

Keith Thompson

Alan Connor said:
Gottya. Thanks.

Something I forgot to mention before: One if the first things that
breaks down if you carry the "pointers are like symlinks" analogy too
far is that pointers, unlike symlinks, are typed. An object of type
"int*" can only point to an int. (As a special case, "void*" is a
generic pointer type that doesn't point to any specific type of
object; it's a raw address that can be converted to and from other
pointer types.)
 
K

Keith Thompson

Alan Connor said:
The fact that a bunch of obvious jerks don't like you is an extremely
good recommendation in my book, Roose.

Alan, I believe you're making a mistake. As a relative newcomer to
this newsgroup, I can certainly understand you not being interested in
some of the recent discussions about topicality and netiquette. Such
things are an unfortunate side effect of having such a free-wheeling
community with no central control.

Roose is, I believe, being deliberately disruptive. Richard and
others (including myself to some extent) have been criticizing him for
his behavior and correcting his misstatements. Richard in particular
has been an extremely valuable and valued contributor to this
newsgroup for many years, because of his technical expertise, his
willingness to share it with others, and his willingness to learn from
others. If you choose to pay attention to Roose and ignore Richard,
the loss will be yours.

That's my advice. Take it or leave it.
 
R

Richard Heathfield

Randy said:
Great. I get killfiled (oh no!) for laughing at the obvious joke RJH was
referring to, with respect to Ritchie and topicality.

So be it.

Being killfiled by such people is like having your car registration number
written down in an eight-year-old car-spotter's notebook as you pass under
the trollbridge at seventy mph. You don't actually notice the event all
that much, and it certainly doesn't affect your life, but it makes /his/
day, and that's what matters.
 

Ask a Question

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.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,220
Latest member
MathewSant

Latest Threads

Top