indenting

B

bob

What tool do most of you people use to indent your code? Doing so by
hand is a bit tedious, I think.
 
I

Ian

What tool do most of you people use to indent your code? Doing so by
hand is a bit tedious, I think.
A decent text editor! In my case emacs, but I'm sure just about every
IDE out there has auto indent.

Ian
 
A

Alf P. Steinbach

* (e-mail address removed):
[off-topic in clc++]

What tool do most of you people use to indent your code? Doing so by
hand is a bit tedious, I think.

The 'Tab' key + editor smarts.

Adding a standardized comment at the very top about indent and tab size:

// indent = tab = 4.

A great many editors support indenting a block by marking it and pressing
'Tab', and similarly, undenting by pressing 'Shift Tab'.

Some projects, e.g. Boost, have instead standardized on always using spaces.
I think that's counter-productive. Really, I hate code that uses spaces for
indenting. Ordinary navigation requires more key-presses. And if you want to
present that code using a proportional font, then there is in general nothing
that indicates whether a space is a just a space or whether it's used to line
up text vertically (spaces at the start of a line are a special case).

Not that I've ever done that proportional font presentation. However, some
folks (including Bjarne Stroustrup) do. It looks rather neat in an article.
Also, code using tab characters can alway be automatically converted to code
using spaces, e.g., the Visual Studio editor does this, and it should always
be done before posting code on Usenet or using it in an article, because of
different tab size conventions; it's trivial to do and no problem. Conversion
of spaces code to code with tabs is however in general impossible to fully
automate, although the mentioned editor attempts to do that, too: one example
where it requires manual editing is right hand comment vertical line-up.

XFUT: [comp.programming]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top