Re: Braces or not [Re: cat]



On Thu, 6 Mar 2008 08:38:09 UTC, Micah Cowan <micah@xxxxxxxxxxxxxxxx>
wrote:

Richard Heathfield <rjh@xxxxxxxxxxxxxxx> writes:

If that's what you mean, then my answer is:
- It's not appreciably harder to add braces later than it is to put
them in in the first place.

Agreed. BUT - it is appreciably harder to remember to add them later on
special occasions than to put them in every time as a matter of habit.

Hm. I haven't found it to be so.

while (c)
c=do_it(c);
c=do_another_thing(c);

looks too broken right away for me not to notice it (though, perhaps
now that I'm doing more Python coding work these days, that may
change?).

I used to actually always put the braces in. I've fallen out of that
practice, just because I find it slightly more readable without, for
one-line bodies.

Uh, a halfways intelligent editor will help in writing/editing source.

So my editor is set up expanding 'while' to

while (_) {
}

setting the cursor at the position represented by the underline
charater. Leaving the condition with TAB will insert an empty line,
placing the cursor in the new linedirectly under the 'l' from while,
so new indent is done, ready to type. Enter will insert a new line,
holding the same indent. Shift Enter in insert mode will insert a new
line under the closing bracket and the cursor under it.

Equivalence is given for do, for an so on magically. So conditional
blocks are magically written, indending is done automatically.

The behavior of enter, TAB and opening brace characters changes
depending on the insert|override mode, Enter, shift enter, Ctrl Enter
and Alöt Enter have different mode too. So typing a new program gets
easy, edit it too.

So leaving a block off from typing is at least more hard than having
it already. Indent is set magically, so misleading gets harder having
it right.

--
Tschau/Bye
Herbert

Visit http://www.ecomstation.de the home of german eComStation
eComStation 1.2R Deutsch ist da!
.



Relevant Pages

  • Re: Coding standards
    ... variables and the C idiom that was established with the C standard library. ... There's no need for any braces ... with spacing used to make a nested parameter ... >> I know almost nothing about the `indent' utility. ...
    (comp.lang.c)
  • Re: oscillator
    ... Read other peoples code and learn to indent and use your ... braces clearly and consistently. ... consistent. ... As to level of understanding, I don't profess to be a C expert or I ...
    (comp.lang.c)
  • Re: Format C# Braces in IDE?
    ... > {// inline as indicated ... several suboptions under Formatting that affect how C# code is formatted. ... Check all options under New Lines->New line options for braces. ... Check "Indent block contents" under Indentation and uncheck "Indent open ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Braces or not [Re: cat]
    ... Richard Heathfield writes: ... BUT - it is appreciably harder to remember to add them later on ... I used to actually always put the braces in. ... practice, just because I find it slightly more readable without, for ...
    (comp.lang.c)
  • Re: strcpy warning
    ... > habit I picked up from Perl, which requires the braces, but I find it ... indent the body a full level. ... have a harder time with other people's code than I might if I just ... so I might as well be consistent. ...
    (comp.lang.c)