Date: Mon, 7 Aug 2000 11:10:03 -0700 (PDT) From: Johan Karlsson <k@numeri.campus.luth.se> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/9869: Addition to style(9) about usage of macro. Message-ID: <200008071810.LAA78235@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/9869; it has been noted by GNATS. From: Johan Karlsson <k@numeri.campus.luth.se> To: FreeBSD-gnats-submit@FreeBSD.ORG Cc: bde@FreeBSD.ORG Subject: Re: kern/9869: Addition to style(9) about usage of macro. Date: Mon, 07 Aug 2000 20:09:53 +0200 Hi Bruce Regarding MACRO in style(9) (see http://www.FreeBSD.org/cgi/query-pr.cgi?pr=9869) This is what the manpage says currently about MACRO:s =============== Macros are capitalized, parenthesized, and should avoid side-effects. Put a single tab character between the `#define' and the macro name. If they are an inline expansion of a function, the function is defined all in lowercase, the macro has the same name all in uppercase. If the macro needs more than a single line, use braces (`{' and `}'). Right-justify the backslashes; it makes it easier to read. If the macro encapsulates a compound statement, enclose it in a ``do'' loop, so that it can safely be used in ``if'' statements. Any final statement-terminating semicolon should be supplied by the macro invocation rather than the macro, to make parsing easier for pretty-printers and editors. #define MACRO(x, y) do { \ variable = (x) + (y); \ (y) += 2; \ } while(0) =============== Do you think that is enough or should it say anything more? If it is enough, I think this PR 9869 can be closed. Thanks Johan K To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200008071810.LAA78235>