|
I thought this was a club.
I really dislike that VS leaves trailing whitespace.
|
|
|
|
|
How hard is it to select a section of code and press alt-f8 (VC6) even if you get unformatted code from someone else?
ANS: not much.
-Prakash
|
|
|
|
|
Mr.Prakash wrote: How hard is it to select a section of code and press alt-f8 (VC6)
Then you have code formated in some funny ways the VC6-team saw fit.
At least in C++, the formatting can not be set to adhere to (my) one and only way.
C# ist better here.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
VC6 code formating is quite same that you will see in most of the code you find anywhere in the world.
-Prakash
|
|
|
|
|
Mr.Prakash wrote: VC6 code formating is quite same that you will see in most of the code you find anywhere in the world.
Maybe.
But it is not the same as the one and only way as brought to us by the prophets Kernighan & Ritchie.
The if s are wrong (and waste a line), the switch/case is mis-formated and so on.
All in all I want my code formated like I want it, not like someone in the middle management of Microsoft wants it.
Besides - in the C#-Editor they got it.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
yes ofcource you can always format the code the way you want it, there is no issue about that. But if you have a unformated code, then visual studio's code formater is a good way to start with.
-Prakash
|
|
|
|
|
Code? Who cares, who try’s (notice I said try’s) to be pedantic about posts made to Code Project? Knowing the grammar police will be all over you like flies on [insert creative word here].
Actually it’s a good thing, I’m certainly more careful in general about what I type after getting tarred & feathered once or twice.
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
S Douglas wrote: I’m certainly more careful in general about what I type after getting tarred & feathered once or twice.
Anything to do with what I pointed out last night?
Cheers,
Vikram.
"Life isn't fair, and the world is full of unscrupulous characters. There are things worth fighting for, killing for and dying for, but it's a really small list. Chalk it up to experience, let it go, and move on to the next positive experience in your life." - Christopher Duncan.
|
|
|
|
|
Vikram A Punathambekar wrote: Anything to do with what I pointed out last night?
Hardly, that was more of a general thought. Besides, I actually expect worse from you has you are a notes user, notes clearly corrupts everything in its path even ones mind.
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
Cheers,
Vikram.
"...we are disempowered to cultivate in their communities an inclination to assimilate to our culture." - Stan Shannon.
|
|
|
|
|
Have you ever worked with someone who wrote "books" of comments?
A few lines of code -- preceeded by 10 or 15 lines of comments.
Regurally! I did. I did NOT like to get into his code! Everything
was explained (in DETAIL); but it was hard to follow the logic.
Now ... this was when I use Emacs and programmed in C on UNIX; but
even with todays VS7 IDE and the availablity of outlineing. One can
"over comment". I like pragma regions! I can write a long winded
explination why I did something and put it within a pragma region
close the region and all is well
Personally -- I am somewhat long winded (can't you tell ) So my
comments abound. But! There are limits. A nice balance.
Consistancy of formating and consistancy in comments!
(By the by -- on spelling -- I am a poor speller. And the VS IDE
does not contain a spell checker. I have found that a little program
call "ClipMate" has an excellent spell checker. Just copy your comment
to the clipboard -- use ClipMate's spell checker and paste it back in.
Simple!)
WedgeSoft
|
|
|
|
|
Gammill wrote: And the VS IDE
does not contain a spell checker
Take a look at Spelly from WndTabs[^] Works well enough in VS6. Haven't tried it in VS2005.
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
It works OK in VS 2003. Though I couldn't get it to work on my work PC. however, it was a machine used by several previous people so that may have been the problem. Not tried it in VS 2005. I also use TextPad's spell checker on the VS source files.
Kevin
|
|
|
|
|
Not interested. As I said -- ClipMate is great. It will not go
through all the code; picking out comments and spell check; but
those hunks I want checked are easily checked. And it works great
for things like this little note -- I'll Ctrl-A, Ctrl-C, Ctrl-Sh*t-C,
F7, and Ctrl-V and this little note has been checked. (Reads, like
a lot; but programmers should be good with accelerators, shouldn't they?)
WedgeSoft
|
|
|
|
|
Gammill wrote: Ctrl-sh*t-C
Did you spell check this post or did you intend to use a swear word?
|
|
|
|
|
-- my bad -- "Ctrl-Shift"
WedgeSoft
|
|
|
|
|
Gammill wrote: Have you ever worked with someone who wrote "books" of comments?
A few lines of code -- preceeded by 10 or 15 lines of comments.
Regurally! I did. I did NOT like to get into his code! Everything
was explained (in DETAIL); but it was hard to follow the logic.
Back in college I kept getting notes from the TA saying "not enough comments" and got irritated at getting the same thing no matter what I tried (we're talking within reason here, headers, end of loop markers variables, etc.).
So I decided to get "unreasonable" and go "overboard". Out of an assignment with 230+ lines of code there were over 250 lines of comments. There was a header comment, that included full psuedo code of the entire procedure to follow as well as a full english description of the process, every line of code that matched the pseudo code had the matching line of pseudo-code repeated yet again. So there were 250+ additional lines of comments, plus most code lines had additional line comments on them....
It backfired, the TA wrote "good comments, could be expanded some more" I was glad when that class was over.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
Knew it! I read the first of your message in email, the rest on
log in to Code Project; but I just knew that was going to be the
punch line. I was luck. I did not graduate with a programming
degree. Learned my code on job and at home and from self sudsy.
Never had to go through that stuff.
WedgeSoft
|
|
|
|
|
I agree. I am a strong believer in comments, but there are coding styles in which comments containing little useful information are required. In most cases these only make code unreadable. Full documentation belongs in the manual. Only information pertaining to the code belongs in the code.
|
|
|
|
|
|
Let's see, when I format my code,
1. All indents are all tabs, or all whitespaces to be consistent.
2. No whitespaces or tabs at the end of any line.
3. The spacing between lines are always consistent. (e.g.: Skipping one line between methods.)
4. ... let's not get into spacing between tokens ...
ROFLOLMFAO
|
|
|
|
|
What would be really nice is if the code formatting dynamically adjusted and tracked the style of the particular user typing the code.
for example, if Joe Bob were typing and he preferred:
if( 1 == x ){
int a = x++ ;
}
Then his compadre Juan opened the file he would see:
if(1==x)
{
int a = x++;
}
and so on...
In my opinion, formatting is in the eyes of the beholder... the compiler doesn't care, just as long as it is syntactically correct.
Which means the file could be stored like this:
if(1==x){int a = x++;}
Just my 2 cents
|
|
|
|
|
Well, the compiler may not care, but things like diff tools and concurrent version systems will definitely care.
This is one of the massive advantages of the enforced formatting in Visual Studio - it makes code merging very very easy.
Yeah, the formatting is in the eyes of the beholder, until you start working with other people. Then it becomes necessary to stick to a standard.
While some people may get religious and say "how I format my code is my PERSONALITY!!!", well, there are lots of other things that make you unique. I should think that it would also be part of your personality if you cared whether or not other people could USE your code, too. (not speaking you personally; the global 'you')
|
|
|
|
|
Patrick Sears wrote: enforced formatting in Visual Studio
SAY WHAT?
Does Visual Studio 2005 enforce its own formatting rules?
Where's my sledge hammmer...
Software Zen: delete this;
|
|
|
|
|
Actually, it does! I always like to leave one space after an opening '(' and before the closing ')' but VS always comes around and knocks it right off and even worse it actually adds one space before the opening '('! If you wrote this for example:
if( didItCheckOut )
It'd change it to this:
if (didItCheckOut)
But it does this only for C# and not for C++! Say, there's a subtle little signal in there: C++ folks know what they are doing and C# folks need to be told what they must do?!
|
|
|
|