Re: categories in core
[email protected] (Klemens Meyer) Sun, 12 Oct 2003 22:03:56 +0200
| Newsgroups | gmane.comp.tools.memaid.devel |
|---|---|
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, On Sunday 12 October 2003 20:26, Peter Bienstman wrote: > On Sunday 12 October 2003 20:20, you wrote: > > On Sunday 12 October 2003 20:13, David Calinski wrote: > > > So what do you think, use such functions: > > > > > > ma_activate_category (char*); > > > ma_deactivate_category(char*); > > > ma_activate_all_categories(); > > > ma_deactivate_all_categories(); > > > > I think this looks good. It will probably also be more efficient than > > passing arrays around as function arguments. > > Another, albeit smaller advantage is that it keeps the signature of > functions like ma_next_elem() the same as compared to the non-category > version. Much easier for the client developers ;-) I have looked into the code a bit, and have to say that implementation may not be the best at all. You have to deliver a category string to almost every function which is then translated with a loop to the category number. That is a real CPU-eater. It could even slow down the response times of the program when having a large number of categories. There are two possible solutions: 1. The parameter should expect the category number. Then a lookup is not necessary. 2. Setting the category number globally with your ma_activate* functions you proposed above. That has also the advantage that all the functions does not need to have a category parameter at all. That has also the advantage that the interface to the core routines does not need to be changed. In my personal opinion I would prefer the second solution. Klemens - -- Quote of the day: ADA, n.: Something you need only know the name of to be an Expert in Computing. Useful in sentences like, "We had better develop an ADA awareness." -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQE/ibOywG0rxVkueMYRAupoAJ9ws/UyLjsGBLOZrhnqXkF5b4yHwwCeOrd2 n3fQ0a550VIrkBRmx7OpiN0= =Dr9z -----END PGP SIGNATURE----- ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. SourceForge.net hosts over 70,000 Open Source Projects. See the people who have HELPED US provide better services: Click here: http://sourceforge.net/supporters.php