Skip to content

Comment on The 5-minute Guide to C Pointers

Comments

30 second guide to C pointers, from Alice in Wonderland:

`It's long,' said the Knight, `but very, very beautiful. Everybody that hears me sing it -- either it brings the tears into their eyes, or else -- '

`Or else what?' said Alice, for the Knight had made a sudden pause.

`Or else it doesn't, you know. The name of the song is called "Haddocks' Eyes."'

`Oh, that's the name of the song, is it?' Alice said, trying to feel interested.

`No, you don't understand,' the Knight said, looking a little vexed. `That's what the name is called. The name really is "The Aged Aged Man."'

`Then I ought to have said "That's what the song is called"?' Alice corrected herself.

`No, you oughtn't: that's quite another thing! The song is called "Ways and Means": but that's only what it's called, you know!'

`Well, what is the song, then?' said Alice, who was by this time completely bewildered.

`I was coming to that,' the Knight said. `The song really is "A-sitting On A Gate": and the tune's my own invention.'

The song that the Knight is referring to is this one: http://en.wikipedia.org/wiki/Haddocks%27_Eyes

Over the past four months I wrote a library in C. In said library exists the following chain:

typedef hidden pointer -> object -> dictionary -> attribute object -> linked list -> object

Then the whole thing can start again from the last object. At both the linked list and dictionary points the pointers have been cast to void. During development there was linked list in place of the dictionary. Since this was before I wrote output debuging involved manually walking the two linked lists.

Else where a function takes a void * array of structs yet needs to access the contents and thus requires a pointer to an accessor function.

I love C but it can get confusing. My plan is to spend the next few weeks in recovery learning RoR.

You might want to look at Go. It always felt like a revised version of C with great standard library and sane defaults.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.