Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] lojza.h: release early, release often . . . . . . . .
- Date: Sat, 29 Jul 2006 13:13:50 +0900
- From: "Stephen J. Turnbull" <stephen@example.com>
- Subject: Re: [tlug] lojza.h: release early, release often . . . . . . . .
- References: <20060726125907.GH5111@example.com> <20060727081940.GM5111@example.com> <20060727120544.6e18e45f.jep200404@example.com> <87vepia17q.fsf@example.com> <30ce84360607280328hb998e2h35e9304db7c39803@example.com>
- Organization: The XEmacs Project
- User-agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.5-b27 (linux)
>>>>> "Ian" == Ian Wells <ijw@example.com> writes: sjt> Really, you should be aiming at exactly the necessary number sjt> of parentheses. Ian> I think it's safer to put [parens around #define values] in Ian> than not, because you're reducing the number of circumstances Ian> where you get bitten. Generally a good idea to stick Ian> brackets around parameters used in defines too... #define thing(a, b, c) a&b|c /* let's say this is exactly what you meant, with the minimum number of parentheses */ retval=thing(x|y, z&w, v)&e|f /* however, this almost certainly isn't what you meant at all */ Hey, that's cheating! I didn't write "minimum", I wrote "necessary". If "thing" is intended to have inline function semantics, then a layer of parenthesis *is* necessary to implement those semantics in this case. But Jim is putting parens around manifest constants defined as literals. This is absolutely unnecessary unless you've got a non-tokenizing preprocessor, and even then you have to work pretty hard to hurt yourself. BTW, Ian, wouldn't you get fired for submitting code like that? Even (maybe especially ;-) if you're self-employed! >> If it starts turning into work to get them right, it's time to >> think about strategies for avoiding use of #define. Ian> This is what made me bite. #define is crufty, I agree, but Ian> inline is not C89 "Premature optimization is the root of all error." If you must port to a C that sucks so bad that it doesn't at least ignore "inline" #define inline is a perfectly reasonable way to deal with it ex post. Ian> (and most compilers aren't C99, and since I'm on a project Ian> with no fixed processor or toolchain at the moment I'm quite Ian> appreciative of people who keep their code portable). Hey, XEmacs runs on more platforms than NetBSD ever has (although I'm cheating here because I'm counting CPU x OS x window-system-or-lack-thereof, I think in context the point stands). I appreciate portable code, too, and where portability matters it's worth getting the defines right. But Michal is writing project-specific code for two platforms: GNU C on i386, and the Many Eyes Simulator. Especially for the latter, clarity counts. Even on portability grounds, it's not obviously a bad way to go. It's much easier to port clear code than it is to verify that obscure code is portable. Ian> And enum {x=1.23} simply doesn't work. I did mention ints, did I not? -- School of Systems and Information Engineering http://turnbull.sk.tsukuba.ac.jp University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN Ask not how you can "do" free software business; ask what your business can "do for" free software.
- Follow-Ups:
- References:
- [tlug] issues with format of double (or IEEE754)
- From: Michal Hajek
- [tlug] just a quick note... more to come later :)
- From: Michal Hajek
- [tlug] lojza.h: release early, release often . . . . . . . . (was Re: just a quick note... more to come later :))
- From: Jim
- Re: [tlug] lojza.h: release early, release often . . . . . . . .
- From: Stephen J. Turnbull
- Re: [tlug] lojza.h: release early, release often . . . . . . . .
- From: Ian Wells
Home | Main Index | Thread Index
- Prev by Date: [tlug] Linux Kanji Optical Character Recognition (OCR) software?
- Next by Date: [tlug] Bugger Job Security . . . . . .(was Re: lojza.h: release early, release often)
- Previous by thread: Re: [tlug] lojza.h: release early, release often . . . . . . . .
- Next by thread: [tlug] Bugger Job Security . . . . . .(was Re: lojza.h: release early, release often)
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links