Moderators: phlip, Moderators General, Prelates
IMHO tabs are more correct because the length of a tab is non defined.
crazyjimbo wrote:That's a problem. How can something that can look different on everyone's computer be a good standard for consistent presentation?
EvanED wrote:crazyjimbo wrote:That's a problem. How can something that can look different on everyone's computer be a good standard for consistent presentation?
For the same reason that it doesn't matter two hoots what font someone chooses for their editor.
if something then
my_method(argument_1,
argument_2);
<tabs>< spaces >
end
crazyjimbo wrote:My main gripe with their inconsistency is the point I mentioned above in that you need to switch between tabs and spaces to get consistent indenting of multiline methods. E.g.
...
The fact we need to do this stems from tabs not being consistent across environments and this is thus a problem. It relies far too much on us humans being good at indenting. Considering we can't even see what we are doing/have done, this is too much to ask.
On a related note, I hope everyone agrees that tabs should be 4 spaces
Sc4Freak wrote:I like a compromoise. My IDE (VS2005) inserts spaces when I press [tab], and also when backspacing whitespace it deletes spaces as if they were tabs. So I have all the convenience of tabs, and all the benefits of spaces.
hermaj wrote:No-one. Will. Be. Taking. Cheese's. Spot.
phlip wrote:Ha HA! Recycled emacs jokes.
Anpheus wrote:(and honestly, if you're editing code with a box that doesn't have regex to do the reverse, what the fuck development environment are you running there?)
zenten wrote:What are people talking about when they say "alignment" anyway?
int func(long variable_name, long variable_name_two, long variable_name_three,
_ _ _ _ _long variable_name_four, long...
int func(long variable_name, long variable_name_two, long variable_name_three,
--->_ _ _long variable_name_four, long...
int func(long variable_name, long variable_name_two, long variable_name_three,
------->_ _ _long variable_name_four, long...
class foo {
--->
--->void foo() { }
--->
--->int func(long variable_name, long variable_name_two, long variable_name_three,
--->_ _ _ _ _long variable_name_four, long variable_name_five) {
--->--->for (int i = 0; i < 10; i++) {
--->--->--->bar fubar = new bar(5, //argument 1
--->--->---> _ _ _ _ _ _ _ _ _ _"six", //argument 2
--->--->---> _ _ _ _ _ _ _ _ _ _7.0, //argument 3
--->--->---> _ _ _ _ _ _ _ _ _ _'\7'); //argument 4
--->--->}
--->}
}
crazyjimbo wrote:On a related note, I hope everyone agrees that tabs should be 4 spaces
Dingbats wrote:I'm currently using four space (as in space) indents when writing Python, but after reading this I'll likely use tabs in the future. Oh, and 80 chars width.
protected virtual void myFun(object myFirstArgumentWichIsAnObjectAndHasAVeryLongName,
--->object mySecondArgumentWichIsAnObjectAndHasAVeryLongName)
{
--->if (test1
--->--->&& test2)
--->{
--->--->[blah blah blah]
--->}
}Dongorath wrote:(and don't like having to press backspace 4 times to go back down 1 tab).
phlip wrote:Ha HA! Recycled emacs jokes.

Kizyr wrote:For code, always spaces. Tabs irritate the hell out of me in code. Making readable code means aligning things in a certain way, and tabs = inconsistent alignment, particularly since code should be in monospaced font anyway.
Dongorath wrote:Definitely tabs (4 spaces wide), no alignement, 120 chars per line.
Tabs because I'm used to them (and don't like having to press backspace 4 times to go back down 1 tab).
No alignement because I think that a single tab do the trick :
- Code: Select all
protected virtual void myFun(object myFirstArgumentWichIsAnObjectAndHasAVeryLongName,
--->object mySecondArgumentWichIsAnObjectAndHasAVeryLongName)
{
--->if (test1
--->--->&& test2)
--->{
--->--->[blah blah blah]
--->}
}
120 chars per line because I use wide screens on a graphical interface (fill nicely on a 17" monitor, a little bit more than half the screen on a wide 24" screen).
And I agree that people that aren't consistent must spend an eternity burning in hell (or whatever equivalent in the religion of your choice).
And above all, I can't stand trailing white characters... But that's just me...
------->if (test1
------->------->&& test2)->if (test1
->->&& test2)->if (test1
-> _ _&& test2)-->if (test1
--> _ _&& test2)---->if (test1
----> _ _&& test2)-------->if (test1
--------> _ _&& test2)Anpheus wrote:There's a problem with your definition of alignment. You aren't aligning anything except by coincidence ("if (" is four characters, but "while (" is seven.)
EvanED wrote:zenten wrote:What are people talking about when they say "alignment" anyway?
We've had that discussion before. It's sorta in the wrong thread, but oh well, such is life.
zenten wrote:Tabs align that just fine. In fact, that's the whole point of tabs, otherwise you just have a macro for a set number of spaces, which is much less useful.
EvanED wrote:zenten wrote:Tabs align that just fine. In fact, that's the whole point of tabs, otherwise you just have a macro for a set number of spaces, which is much less useful.
No they don't. Did you read the post Anpheus just posted, like 30 minutes ago, in this very thread?
If you are using tabs for alignment, things will align at exactly one tab setting, and this setting differs between control constructs and what you are trying to align. "Coincidentally", that setting is exactly the number of spaces that should have been inserted instead of a tab.
if (x
--->&& y)if (x
------->&& y)Anpheus wrote:What are you talking about? Open up Notepad++ or any editor that lets you configure tab size.
Switch to a 4 space tab.
Type:
- Code: Select all
if (x
--->&& y)
The ---> is a tab.
Then switch to an eight space tab. You get:
- Code: Select all
if (x
------->&& y)
It's no longer aligned.
Tab boundaries:
-------|-------|
while-->(
------->&&stuffTab boundaries:
---|---|---|---|
while-->(
--->&&stuffdo
if
asm
for
new
try
auto
case
else
enum
goto
this
TRUE
void
break
catch
class
const
FALSE
throw
union
using
while
delete
export
extern
friend
inline
public
return
signed
sizeof
static
struct
switch
typeid
default
mutable
private
typedef
virtual
continue
explicit
operator
register
template
typename
unsigned
volatile
namespace
protected
const_cast
static_cast
dynamic_cast
reinterpret_castphlip wrote:Ha HA! Recycled emacs jokes.
enk wrote:I agree, spaces for alignment. But hey, spaces for indentation too.
The problem in having your editor showing tabs as 4 spaces is that it won't look the same in another guys editor!
And this is important if you're concerned about your code maxing at 80 cols...
Anpheus wrote:HERETIC!
There's a problem with your definition of alignment. You aren't aligning anything except by coincidence ("if (" is four characters, but "while (" is seven.) If you were aligning text, you would end up with horrible, horrible looking code to other people whose tabs are set differently.
Users browsing this forum: No registered users and 1 guest