Indenting: spaces or tabs?
-
Gary Wheeler wrote: Real programmers use EDLIN. no,nononono. REAL coders use punch cards. :rolleyes: BW {insert witty/thought-provoking saying here}
Been there, done that. When I took Data Structures in college, programming was on the IBM 370 mainframe, using punch cards. We had a guy in our class who was blind. This guy read the holes in the cards with his fingers. I helped him do a 'floor sort' one time; it was a good thing he liked sequence numbers in columns 73-80.
"Think of it as evolution in action." - 'Oath of Fealty' by Larry Niven and Jerry Pournelle
-
A little survey about your code-indent style... what do you use? Spaces or tabs? I used to do a mix of tabs and spaces, but the code looked awful when edited with VS and then opened with notepad for a quick look. So I started using only spaces, but I noticed that for some files indentation made the file size grow a lot... now I'm using only tabs. I think that's the best way: any serious code editor can set the tab size to any number of space you want, code in notepad looks fine, and it's faster to type and files don't get too large. These are my 2 cents. And yours? Luca Leonardo Scorcia http://zip.to/kojak (only in Italian)
I use tabs. :)
43 68 65 65 72 73 2c 4d 69 63 68 61 65 6c
-
Been there, done that. When I took Data Structures in college, programming was on the IBM 370 mainframe, using punch cards. We had a guy in our class who was blind. This guy read the holes in the cards with his fingers. I helped him do a 'floor sort' one time; it was a good thing he liked sequence numbers in columns 73-80.
"Think of it as evolution in action." - 'Oath of Fealty' by Larry Niven and Jerry Pournelle
Gary Wheeler wrote: We had a guy in our class who was blind. This guy read the holes in the cards with his fingers. :cool: Very impressive! I guess having used cards helps to appreciate the speed and convenience we have today. And to think I used to gripe about waiting for the cassette drive to finish loading. BW {insert witty/thought-provoking saying here}
-
A little survey about your code-indent style... what do you use? Spaces or tabs? I used to do a mix of tabs and spaces, but the code looked awful when edited with VS and then opened with notepad for a quick look. So I started using only spaces, but I noticed that for some files indentation made the file size grow a lot... now I'm using only tabs. I think that's the best way: any serious code editor can set the tab size to any number of space you want, code in notepad looks fine, and it's faster to type and files don't get too large. These are my 2 cents. And yours? Luca Leonardo Scorcia http://zip.to/kojak (only in Italian)
Tabs set to 4 spaces. Jason Gerard
-
I want to use tabs but have to use spaces, and it sucks.. X| With tabs everybody can have the tabwidth they want. If you want to delete the tab you just type you only have to press backspace once. Easier to reformat the code. I cant see a single advantage with using spaces. /Magnus
- I don't necessarily agree with everything I say
I cant see a single advantage with using spaces. Because if you have your tabs set differently from me, any indentation other than the beginning-of-line, one-tab indentation gets screwed up. It's mostly a problem when you use end-of-line comments, aligned variable initializations, or indentation for the definition of long functions, all shown below:
sometype_t CSomeClass::SomeRandomFunction(footype_t arg1,
footype_t arg2)
{
somestruct_t thing;
thing.a = -1;
thing.longerName = 10;
thing.evenLongerName = 5;doSomething(); // And explain why doSomethingElse(); // And explain that, too doSomethingWithALongName(); // And this one, too
}
The arguments won't line up if you use tabs at a different width than me, but they will line up if you use spaces. And the argument that spaces take up more disk space than tabs? Geez, what a non-starter! With 80GB hard drives costing less than US$79, what's the point? Do you also use i, j, k, and l for variable names to save space?! ;-) Tim Lesher http://www.lesher.ws
-
Gary Wheeler wrote: Real programmers use EDLIN. no,nononono. REAL coders use punch cards. :rolleyes: BW {insert witty/thought-provoking saying here}
REAL coders use punch cards. And REAL coders who won't/can't adapt are on the dole. ;-) Tim Lesher http://www.lesher.ws
-
I cant see a single advantage with using spaces. Because if you have your tabs set differently from me, any indentation other than the beginning-of-line, one-tab indentation gets screwed up. It's mostly a problem when you use end-of-line comments, aligned variable initializations, or indentation for the definition of long functions, all shown below:
sometype_t CSomeClass::SomeRandomFunction(footype_t arg1,
footype_t arg2)
{
somestruct_t thing;
thing.a = -1;
thing.longerName = 10;
thing.evenLongerName = 5;doSomething(); // And explain why doSomethingElse(); // And explain that, too doSomethingWithALongName(); // And this one, too
}
The arguments won't line up if you use tabs at a different width than me, but they will line up if you use spaces. And the argument that spaces take up more disk space than tabs? Geez, what a non-starter! With 80GB hard drives costing less than US$79, what's the point? Do you also use i, j, k, and l for variable names to save space?! ;-) Tim Lesher http://www.lesher.ws
Tim Lesher wrote: The arguments won't line up if you use tabs at a different width than me, but they will line up if you use spaces But there is no problem pressing the space key even if the tabkey produces *drumroll* tabs. :) So this arugment does not hold. Tim Lesher wrote: And the argument that spaces take up more disk space than tabs? Geez, what a non-starter! With 80GB hard drives costing less than US$79, what's the point? Do you also use i, j, k, and l for variable names to save space?! Where did you get that from? I never said that, and i never would say so..... /Magnus
- I don't necessarily agree with everything I say
-
Spaces at four; whitesmith (Microsoft)-style indenting
int func()
{
for (int i=0; i< 4; ++i)
{
// Like This
;
}
return 0; // With no parens around the zero, dammit!
}Tim Lesher http://www.lesher.ws
Bah... article thread view appears to get rid of initial spacing. Tim Lesher http://www.lesher.ws
-
A little survey about your code-indent style... what do you use? Spaces or tabs? I used to do a mix of tabs and spaces, but the code looked awful when edited with VS and then opened with notepad for a quick look. So I started using only spaces, but I noticed that for some files indentation made the file size grow a lot... now I'm using only tabs. I think that's the best way: any serious code editor can set the tab size to any number of space you want, code in notepad looks fine, and it's faster to type and files don't get too large. These are my 2 cents. And yours? Luca Leonardo Scorcia http://zip.to/kojak (only in Italian)
Spaces at four; whitesmith (Microsoft)-style indenting
int func()
{
for (int i=0; i< 4; ++i)
{
// Like This
;
}
return 0; // With no parens around the zero, dammit!
}Tim Lesher http://www.lesher.ws
-
Tim Lesher wrote: The arguments won't line up if you use tabs at a different width than me, but they will line up if you use spaces But there is no problem pressing the space key even if the tabkey produces *drumroll* tabs. :) So this arugment does not hold. Tim Lesher wrote: And the argument that spaces take up more disk space than tabs? Geez, what a non-starter! With 80GB hard drives costing less than US$79, what's the point? Do you also use i, j, k, and l for variable names to save space?! Where did you get that from? I never said that, and i never would say so..... /Magnus
- I don't necessarily agree with everything I say
But there is no problem pressing the space key even if the tabkey produces *drumroll* tabs. Correct, but Dev Studio auto-indents the arguments for you, and if you have tabs as your default, it uses a mixture of spaces and tabs. Of course, the error may be relying on Dev Studio's auto indent. It also butchers long for statements if you break after each semicolon. And the argument that spaces take up more disk space than tabs? Geez, what a non-starter! Where did you get that from? I never said that, and i never would say so..... You didn't, but it was mentioned in the thread, and I couldn't be bothered to go back and put it after the right response... :-) Tim Lesher http://www.lesher.ws
-
Spaces at four; whitesmith (Microsoft)-style indenting
int func()
{
for (int i=0; i< 4; ++i)
{
// Like This
;
}
return 0; // With no parens around the zero, dammit!
}Tim Lesher http://www.lesher.ws
Tim Lesher wrote: return 0; // With no parens around the zero, dammit! Obviously not, "return" isn't a function call, is it?! :-)