5 ms·
You're doing something wrong, then. Here's a block of dummy code indented with tabs; copy-paste it into your editor, change the tab widths, and observe that the
by jmillikin 13y ago
You're doing something wrong, then. Here's a block of dummy code indented with tabs; copy-paste it into your editor, change the tab widths, and observe that the indentation stays readable.
void my_function(int some_parameter, int another_parameter,
int the_third_parameter) {
if (some_parameter != another_parameter) {
here_we_are_in_an_if();
}
function_calls_work_fine_too(some_parameter,
the_third_parameter);
}
- Locke1689 13y agoMaybe I don't understand the argument: what if `int the_third_parameter` lies on an odd column. How would one indent to that column using only tabs of an even shift width?
- jbri 13y agoThe optimal mechanism is to indent with tabs, and align with spaces (that is, you have the same number of preceding tabs as whatever you're trying to align with, and then use spaces from there). Though setting your editor up to do that automatically is an incredible pain, and it kind of forces you to use a monospace font.
- Locke1689 13y agoAh, I didn't see the distinction between "indent" and "align." Anyway, it seems like this system necessitates that the leading white space on a given line must be a mixture of both tab characters (\t) and spaces, unless one sets their editor to insert space characters as tabs (which is standard), and is obviously living in a state of sin.
- sesqu 13y agoOn every line that is right-aligned, yes. Most lines would have only tabs.
- XorNot 13y agoWho isn't using a monospace font for code editing? I didn't even realize this was a thing.
- jbri 13y agoThe primary reason people use monospace fonts is historical inertia. It's definitely worth trying out a proportional font if your environment is amenable to it (some tools don't cope particularly well, for sad and disappointing reasons).
- 10098 13y agoI tried doing that. It looks uglier than Sloth from the Goonies.
- ufo 13y agoIIRC, Stroustoup uses a non-monospaced font in his C++ book.
- deleted 13y ago[deleted]
- deleted 13y ago[deleted]