Re: Naming curiosity



Lorenzo Villari wrote:


"Chris Dollin" <chris.dollin@xxxxxx> ha scritto nel messaggio
news:ggmfh8$oqm$1@xxxxxxxxxxxxxxxxxxxxxx

Why the /heck/ would you use `void*` not `struct sList*` for `head` and
`prev`? The structure is just as recursive (or not) even if you lie about
the types of the pointers.

In fact is not me, it's an oversemplification of code I've found and
perplexed about.

You said "If I define a linked list this way", not "I found this
code I'm perplexed about".

I normally use the canonical way of defining a linked list.

Good.

Sometimes the head is a data item and sometimes the head is a list
head? IMAO, this is just asking for trouble. At the very least you
could make this type a union, but it's not clear to me why you're
making life so complicated for yourself.

Same as above

Me, too.

It looks like a doubly linked list, not a plain linked list.

Yeah I know the distinction between the two. I meant the term in a general
way. There's a lot of data structure and since I don't know everything, I
thought of the possibility of another one unknown to me...

It's a doubly linked list with obfuscation. (Maybe, if you show us
the unoversimplified code, we'd be able to disperplex you.)

--
"Possibly you're not recalling some of his previous plans." Zoe, /Firefly/

Hewlett-Packard Limited Cain Road, Bracknell, registered no:
registered office: Berks RG12 1HN 690597 England

.



Relevant Pages

  • Re: Naming curiosity
    ... void *head; ... I don't use a recursive structure using pointers to the structure itself ... struct sList *prev; ... misunderstand the real purpose of the head field. ...
    (comp.lang.c)
  • Re: [PATCH][RT] 2.6.24-rc2-rt1 drivers/dma/ioat_dma.c compile fix
    ... I'm not positive about the insertion point... ... compile error fix (needs review) ... RT changes __list_splice to require prev and next pointers. ...
    (Linux-Kernel)
  • Automatic updating of table/Form data
    ... with Macro commands I have to use or any other pointers ... With Reg, ... Samantha ... Prev by Date: ...
    (microsoft.public.access.macros)
  • Re: strcat and three strings
    ... My first suggestion is that you did not allocate any space for your ... you only defined the pointers. ... instead of only a snippet. ... Prev by Date: ...
    (comp.lang.c)
  • Re: Another liberal news lie! Now Newsweek!
    ... First you have a bogus news source and second Newsweek themselves ... admitted the story had no real proof (lie). ... Prev by Date: ...
    (sci.med.diseases.lyme)