Re: [HACKERS] Double linked list with one pointer

2003-12-08 Thread Abhijit Menon-Sen
At 2003-12-07 18:19:26 +0100, [EMAIL PROTECTED] wrote: There is a new type in C99 for integer that can hold a pointer value. I think it's called intptr_t resp. uintptr_t, but I don't have the standard around. Yes, they're called intptr_t and uintptr_t (ยง7.18.1.4), but they're both optional

Re: [HACKERS] Double linked list with one pointer

2003-12-07 Thread Greg Stark
Dann Corbit [EMAIL PROTECTED] writes: From the C-FAQ: A:Not portably, it doesn't. It attempts to modify the variable a twice between sequence points, so its behavior is undefined. 10.3: How can I write a generic macro to swap two values? Neither of these are really relevant,

Re: [HACKERS] Double linked list with one pointer

2003-12-07 Thread Tom Lane
Greg Stark [EMAIL PROTECTED] writes: Treating pointers as integers is technically nonportable but realistically you would be pretty hard pressed to find any architecture anyone runs postgres on where there isn't some integer datatype that you can cast both directions from pointers safely. ...

Re: [HACKERS] Double linked list with one pointer

2003-12-07 Thread Manfred Spraul
Tom Lane wrote: Greg Stark [EMAIL PROTECTED] writes: Treating pointers as integers is technically nonportable but realistically you would be pretty hard pressed to find any architecture anyone runs postgres on where there isn't some integer datatype that you can cast both directions from

[HACKERS] Double linked list with one pointer

2003-12-06 Thread Gaetano Mendola
If I'm not wrong Neil Conway is working on reimplement a double linked list. Looking around I found this post of Herb Sutter on comp.lang.c++: In particular, a motivation behind two-way pointers is that you can have a more

Fwd: [HACKERS] Double linked list with one pointer [mendola@bigfoot.com]

2003-12-06 Thread Richard Schilling
, passing the known pointer value around would take more coding than maintaining two pointers in the list. Richard Schilling - Begin Forwarded Message - Date: 2003.12.06 08:03 Subject: [HACKERS] Double linked list with one pointer From: Gaetano Mendola [EMAIL PROTECTED] To: [EMAIL PROTECTED

Re: [HACKERS] Double linked list with one pointer

2003-12-06 Thread Tom Lane
Gaetano Mendola [EMAIL PROTECTED] writes: If I'm not wrong Neil Conway is working on reimplement a double linked list. No, he's working on keeping track of the list tail element (and length, but the tail element is the important part). There was nothing about double linking. In particular, a

Re: [HACKERS] Double linked list with one pointer

2003-12-06 Thread Bruce Momjian
Gaetano Mendola wrote: If I'm not wrong Neil Conway is working on reimplement a double linked list. Looking around I found this post of Herb Sutter on comp.lang.c++: In particular, a motivation behind two-way pointers

Re: [HACKERS] Double linked list with one pointer

2003-12-06 Thread Dann Corbit
-Original Message- From: Bruce Momjian [mailto:[EMAIL PROTECTED] Sent: Saturday, December 06, 2003 5:02 PM To: Gaetano Mendola Cc: [EMAIL PROTECTED] Subject: Re: [HACKERS] Double linked list with one pointer Gaetano Mendola wrote: If I'm not wrong Neil Conway is working

Re: [HACKERS] Double linked list with one pointer

2003-12-06 Thread Andrew Dunstan
Bruce Momjian wrote: Gaetano Mendola wrote: I don't think the article is available online, alas, but you can find some related source code demonstrating the technique at: http://www.semantics.org/tyr/tyr0_5/list.h That certainly is an amazing idea. You know the pointer you are

Re: [HACKERS] Double linked list with one pointer

2003-12-06 Thread Bruce Momjian
Andrew Dunstan wrote: Bruce Momjian wrote: Gaetano Mendola wrote: I don't think the article is available online, alas, but you can find some related source code demonstrating the technique at: http://www.semantics.org/tyr/tyr0_5/list.h That certainly is an amazing

Re: [HACKERS] Double linked list with one pointer

2003-12-06 Thread Tom Lane
Andrew Dunstan [EMAIL PROTECTED] writes: I must confess that it strikes me as a really really horrid and ugly hack - very likely to be error-prone and non-portable and undebuggable, and for almost no saving worth having. But maybe that's just me. No, that was exactly my reaction too. I'd be