473,385 Members | 1,553 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Explain this !

Hi,

Can anybody explain this..

#define LIST_DESTROY(a) list_destroy(a)
#define LIST_ENQUEUE(a, b, c) list_enqueue(a,b,c)
#define LIST_REMOVE(a, b, c) list_remove(a,b,c)
etc...
#define LIST_DESTROY(a) NULL
#define LIST_ENQUEUE(a, b, c) NULL
#define LIST_REMOVE(a, b, c) NULL
#define LIST_HEAD_ELEMENT(a) NULL
#define LIST_GET_DATA(a) NULL
#define LIST_NEXT_ELEMENT(a) NULL
#define LIST_EMPTY(a) NULL

#define FOR_ALL_DATA_IN_LIST(__list, __element, __data) \
for (__element = LIST_HEAD_ELEMENT(__list), \
__data = LIST_GET_DATA(__element); \
__element != NULL; \
__element = LIST_NEXT_ELEMENT(__element), \
__data = LIST_GET_DATA(__element))
Though the name of the MACRO is self-explanatory what i dont understand is
the second list of #define's - why are they defined as NULL

Thanks,
- Ravi
Nov 14 '05 #1
2 1493
Ravi Uday wrote:
Can anybody explain this.. Possibly..
#define LIST_DESTROY(a) list_destroy(a)
#define LIST_ENQUEUE(a, b, c) list_enqueue(a,b,c)
#define LIST_REMOVE(a, b, c) list_remove(a,b,c)
etc...
#define LIST_DESTROY(a) NULL
#define LIST_ENQUEUE(a, b, c) NULL
#define LIST_REMOVE(a, b, c) NULL
#define LIST_HEAD_ELEMENT(a) NULL
#define LIST_GET_DATA(a) NULL
#define LIST_NEXT_ELEMENT(a) NULL
#define LIST_EMPTY(a) NULL

#define FOR_ALL_DATA_IN_LIST(__list, __element, __data) \
for (__element = LIST_HEAD_ELEMENT(__list), \
__data = LIST_GET_DATA(__element); \
__element != NULL; \
__element = LIST_NEXT_ELEMENT(__element), \
__data = LIST_GET_DATA(__element))
Though the name of the MACRO is self-explanatory what i dont understand is
the second list of #define's - why are they defined as NULL

In divination mode, I'd say there's probably an #if or an #ifdef
somewhere, but I think this link may be helpful:
http://www.catb.org/~esr/faqs/smart-questions.html

HTH

rlc
Nov 14 '05 #2
vir
Ravi Uday wrote:
Hi,

Can anybody explain this..

#define LIST_DESTROY(a) list_destroy(a)
#define LIST_ENQUEUE(a, b, c) list_enqueue(a,b,c)
#define LIST_REMOVE(a, b, c) list_remove(a,b,c)
etc...
#define LIST_DESTROY(a) NULL
#define LIST_ENQUEUE(a, b, c) NULL
#define LIST_REMOVE(a, b, c) NULL
#define LIST_HEAD_ELEMENT(a) NULL
#define LIST_GET_DATA(a) NULL
#define LIST_NEXT_ELEMENT(a) NULL
#define LIST_EMPTY(a) NULL

#define FOR_ALL_DATA_IN_LIST(__list, __element, __data) \
for (__element = LIST_HEAD_ELEMENT(__list), \
__data = LIST_GET_DATA(__element); \
__element != NULL; \
__element = LIST_NEXT_ELEMENT(__element), \
__data = LIST_GET_DATA(__element))
Though the name of the MACRO is self-explanatory what i dont understand is
the second list of #define's - why are they defined as NULL

Thanks,
- Ravi

It's seems that the user of this library must provide his redefinitions
of macroses that have been defined as NULL to use this. The main purpose
is something like C++ template construction. I don't know the details
and I can't comment the design. Sometimes it's better to use void*
instead of macroses in C. But if you really need lots of generic
procedures try switching to C++.

--
vir
Nov 14 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Bruce D | last post by:
I'm trying to understand MySQL better. I can't seem to figure out why the second query takes 2 minutes and the first query takes 12 seconds. It should be noted that the table, KBM, has 250...
10
by: Greg Stark | last post by:
This query is odd, it seems to be taking over a second according to my log_duration logs and according to psql's \timing numbers. However explain analyze says it's running in about a third of a...
14
by: Ina Schmitz | last post by:
Hello all, I don't succeed in displaying the explain plan. I use IBM DB2 Universal Database 8.2. I tried to do the example given in the online help for "Visual Explain". The tables...
2
by: Buck Nuggets | last post by:
Since upgrading to db2 8.2.1 I've been having odd problems with visual explain: 1. tables appear to require schema prefixes: SQL0204N "BUCK.DIM_SENSOR" is an undefined name. SQLSTATE=42704...
10
by: Jeff Boes | last post by:
I'm hoping there's someone here with experience in building the Visual Explain tool from Red Hat. I downloaded it and the J2 SDK, but when I attempt to follow the build instructions, I get messages...
5
by: Jon Lapham | last post by:
I have been using the EXPLAIN ANALYZE command to debug some performance bottlenecks in my database. In doing so, I have found an oddity (to me anyway). The "19ms" total runtime reported below...
4
by: marklawford | last post by:
Not having earned my DBA badge from the scouts just yet I'm a little lost with an error I'm getting. We've just upgraded our development database from 7.2 to 8.2 as the first step in upgrading...
2
by: heming_g | last post by:
two tables with the same table structure : tb_xxx and tb_xxx_tmp in table tb_xxx , column "listno" is the primary key of itself and foreign key of dozen of tables . here is my sql .. "...
5
by: kabotnet | last post by:
Hi, I'm new in db2, I'm trying to execute EXPLAIN command on some queries but i have error like: And message similar to: Token EXPLAIN is not valid, valid tokens ( END GET SET CALL DROP FREE...
1
by: w.l.fischer | last post by:
Hi, the following sequence: set current explain mode yes; set current explain snapshot yes; update ...; set current explain mode no;
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.