[chbot] C Coding Style

mikael stewart mikael.stewart at gmail.com
Sat Sep 24 04:54:12 BST 2016


On Fri, Sep 23, 2016 at 3:22 PM, Volker Kuhlmann
<list0570 at paradise.net.nz> wrote:
>
> On Fri 23 Sep 2016 11:14:26 NZST +1200, mikael stewart wrote:
>
> > 1. Use of TAB to indent. All decent, modern IDEs all allow scaling of the
> > tab character. I like large indents (I have a 16:9 monitor and I'm not
> > afraid to use it!), so set TAB to appear as the equivalent of 4 monospaced
> > characters. If I pass my code over to someone else, they can easily
> > re-scale to suit their eyes without reformatting the content (think tab
> > stops in a word processor).
>
> You're stopping short though. To do that properly you'd distinguish
> between the tab character spacing and the tab *key* spacing. So you
> leave tab characters at 8 because too many editors are dumb. Besides, I
> seriously don't want to have to reconfigure editors for each piece of
> source code. Then you set the tab key spacing to whatever you like, e.g.
> 4, and fill up with actual spaces as needed. Works really well. I've
> only ever seen one editor though which implements this properly (nedit),
> and yes even backspace un-indents correctly. It has other problems. Did
> I say editors are dumb?
>

Not sure what you mean by tab character vs tab key. I have a single
tab character inserted with the press of the key for a single level
indent, but I have my editor of choice represent this as if it were 4
mono-spaced characters (or whatever looks right to me).

The automatic replace with space chars is what I dread because
invariably something goes wrong with either the indenting or
un-indenting or both. If you say nedit handles this well I'll have to
give that a go.

Maybe Eclipse which I use more than anything else could handle it too,
but in all the years I've used it I've not tried. If anything gets out
of sync with my style convention (copy+pasting from elsewhere, rogue
space chars etc.), it does have the cure-all CTRL+SHIFT+F (or select
then CTRL+I) to reformat which seems to work OK.



More information about the Chchrobotics mailing list