[ILUG] C puzzle
john.allen at dublinux.net
Tue Jul 6 13:27:57 IST 2004
On Tuesday 06 July 2004 12:00, Paul Jakma wrote:
> On Tue, 6 Jul 2004, Philip Reynolds wrote:
> > You need to use a temporary variable, to allow the use of free() or
> > removal of an element in the list.
> Indeed. the problem is trying to stuff it into the for loop so that
> macro will still work :)
> > #define LIST_LOOP(L, V, N, temp) \
> > for ((N) = (L)->head; \
> > (N) && ((temp) = (N)->next); \
> > (N) = (temp))
> > Something like the above.
> Nah, that breaks the macro.
The correct solution is obviously C++. Macros is bad.
John Allen, mailto:john.allen at dublinux.net
MandrakeClub Silver Member. http://www.dublinux.net
Mandrake Linux release 10.0 (Community) for i586, kernel 2.6.3-13mdk
13:27:32 up 12 days, 5:05, 1 user, load average: 0.33, 0.29, 0.16
More information about the ILUG