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] Bleeding pragmata
- Date: Fri, 17 Feb 2006 16:51:04 +0900
- From: "Stephen J. Turnbull" <stephen@example.com>
- Subject: Re: [tlug] Bleeding pragmata
- References: <30ce84360602161543t37f3dc6ak@example.com><d8fcc0800602161631h3ca19eeeq@example.com><30ce84360602162211q3e789359o@example.com><d8fcc0800602162218o3727624ei@example.com><20060217152200.K818@example.com><d8fcc0800602162229o63f27ca0j@example.com><43F5F32A.8050502@example.com>
- Organization: The XEmacs Project
- User-agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.5-b23 (daikon, linux)
On 17/02/06, Tod McQuillin <devin@example.com> wrote: >>> The C99 standard allows variable declarations anywhere inside >>> a block, not just at the top. This can be a useful technique >>> for limiting the scope of variables to just the section of >>> code where they are used. Saves two characters: '{' and '}'. Big whup. ;-) Of course, according to your coding style you may need to add a bunch of extra whitespace, but for me this is usually balanced by the readability advantage of demarcating the scope of the declaration, and the fact that there's an explicit end-of-scope indicator (which is often more important to me than the beginning-of-scope indicator). >>>>> "Edward" == Edward Middleton <edward@example.com> writes: Edward> Josh Glover wrote: >> Thanks for pointing this out. Edward> Well if you hadn't send the last email you might of got Edward> away with something along the lies of Edward> [1]It's a coding style issue. We put our variable Edward> declarations where people can _find_ them, not in random Edward> places in the code. I'll second that. XEmacs still compiles with GCC 2.4 (although that's an accident, we only *want* to support 2.95 :-). And there are vendor compilers that don't support C99 yet, although they're getting quite rare. Edward> Putting variables in the middle of code only improves Edward> readability when you have messy code. IMO, there's an important exception. It also allows you to initialize at the point of declaration. That can be a perceptible readability improvement if your initialization depends on an intermediate result. Granted, you might be even better off putting the block in a function and letting the compiler inline it, but for inner loop code you might not want to do that, especially if you need to support a lot of compilers and don't know what their policies on inlining are (or know that some compilers won't inline the code in question). Or the block might use a lot of variables that you'd have to pass as arguments, or something. -- 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.
- References:
- [tlug] Bleeding pragmata (was: Re: unicode and Perl- how to passcommand line unicode arguments)
- From: Ian Wells
- Re: [tlug] Bleeding pragmata (was: Re: unicode and Perl- how topass command line unicode arguments)
- From: Josh Glover
- Re: [tlug] Bleeding pragmata (was: Re: unicode and Perl- how topass command line unicode arguments)
- From: Ian Wells
- Re: [tlug] Bleeding pragmata (was: Re: unicode and Perl- how topass command line unicode arguments)
- From: Josh Glover
- Re: [tlug] Bleeding pragmata (was: Re: unicode and Perl- howto pass command line unicode arguments)
- From: Tod McQuillin
- Re: [tlug] Bleeding pragmata (was: Re: unicode and Perl- how topass command line unicode arguments)
- From: Josh Glover
- Re: [tlug] Bleeding pragmata (was: Re: unicode and Perl- howto pass command line unicode arguments)
- From: Edward Middleton
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] unicode and Perl- how to pass command line unicodearguments
- Next by Date: Re: [tlug] -proposal- 2/25 extra TLUG meeting
- Previous by thread: Re: [tlug] Bleeding pragmata (was: Re: unicode and Perl- howto pass command line unicode arguments)
- Next by thread: [tlug] programming stories
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links