From owner-cvs-all Thu Feb 8 23:47:55 2001 Delivered-To: cvs-all@freebsd.org Received: from critter.freebsd.dk (fw2.aub.dk [195.24.1.195]) by hub.freebsd.org (Postfix) with ESMTP id 66E6137B4EC; Thu, 8 Feb 2001 23:47:31 -0800 (PST) Received: from critter (localhost [127.0.0.1]) by critter.freebsd.dk (8.11.1/8.11.1) with ESMTP id f197kuw20582; Fri, 9 Feb 2001 08:46:56 +0100 (CET) (envelope-from phk@critter.freebsd.dk) To: Luigi Rizzo Cc: Bruce Evans , Peter Wemm , Mark Murray , Mike Heffner , cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: QUEUE macros considered harmful (was Re: cvs commit: src/usr.bin/lam lam.c) In-Reply-To: Your message of "Fri, 09 Feb 2001 08:35:35 +0100." <200102090735.IAA31362@info.iet.unipi.it> Date: Fri, 09 Feb 2001 08:46:56 +0100 Message-ID: <20580.981704816@critter> From: Poul-Henning Kamp Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > 15 macros for [doubly-linked ?] circular queues (CIRCLEQ) No longer there. >and apart from the number of them, the interface is not always >obvious, the manpage is not consistent, and the way they are used >is worth a prize at the Obfuscated Programming contest. Some of the code I have converted to use macros were infinitely more obfuscated before. >Simple example taken from the firewall code: As you say "Simple example". Most people can write a correctly structured "make world" program. Try with an example from some more complicated code. And if you don't want to use in your code then don't. I have been advocating changing the users of to not grope around inside the structures in all kinds of bogus and non-bogus manners. Introduction of in code is a different story. I don't advocate that is the best thing since sliced bread, but it is the best that we currently have. >I can admit that there are some cases where a (limited) use >of such macros can simplify life and reduce the chance of errors, >but my feeling is that we are really abusing these macros. I belive in data-hiding. If our chosen language had supported it, the queues wouldn't have been macros. For now I belive that if we have we should hide the implementation details of it so that it can be improved later without having to revisit the code again and again. I will also strike a blow for the people who are not in a position to say that nobody in the world know more about UFS than they do: It is important that our code doesn't require you to be a world class programmer to be able to read it. Many of our new "staff" are new to computers and programming. I certainly don't subscribe to "If it looks complicated it shows how great a programmer I am". >but 'TYPE' is not really a type, (the real type 'struct TYPE'), I have advocated fixing this bogosity earlier, but was shouted down by the "compatible with UNIX 1st edition at all costs" contingent. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message