|
At my workplace we have set up a team Settings file, which means we all use the same automatic formatting rules. This is accessed via Tools > Options > Environment > Import and Export settings then check 'Use team settings file'.
Being in a minority of one, doesn't make you insane George Orwell However, in my case it does
|
|
|
|
|
... so my code can be hard to read with a small monitor.
|
|
|
|
|
I agree. Unless I know with certainty that my code will be viewed on a TTY. Or if I am attempting to follow someone else's style rules. I find that breaking any but the longest lines of code costs me more in lost structural queues than it is worth. I value being able to understand the flow of code easily above almost everything else, and I buy the highest resolution monitors available to see clearly.
|
|
|
|
|
What's really needed is some newer nicer monospace fonts.
One part of my formatting I really insist upon is char allignment. Courier sucks, and the other monotypes I've found haven't improved things much. A good font, of course, is really very important for code formatting - the purpose of both is to improve readability (a broad context to readability).
A pet peeve is how the MS IDE code generator adds pointer (i.e., C++). They leave that astrisk floating out in the middle of space between the type declaration and the member name. Why couldn't they just pick one side or the other? And, maybe - just maybe - as a little something showing consideration for old timers, place it up against the member name. A search&replace fixes it up, but, the satisfaction of making it "look right" still took yet another unnecessary effort.
One thing I do appreciate with formatting: I adjust the settings so that char's and strings (meaning single or double quoted items) have a bright yellow background. This is a great help in avoiding the forgetting closing a quote or accidentally having more of them than you intended; the large gaps of yellow (or lack there of) making them rather obvious.
Alas, I digress.
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein
|
|
|
|
|
Balboos wrote: Courier sucks, and the other monotypes I've found haven't improved things much. A good font, of course, is really very important for code formatting
I really like the Proggy Tiny (Slashed zero) True Type font found at http://www.proggyfonts.com/index.php?menu=download[^]
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Thanks for the Proggy - I visited and grabbed a few. However, after whining in my original post, I relieved my chair of the weight of of my thigh-bones and went hunting. Found "Raize.fon", which is a bit bigger in its usable form. Foolishly, I forgot to keep track of my wanderings, and all that is contained in the file "RzFont.zip" is the font, itself, and not the usual read-me that would help trace it back to its source.
I like to sit further back to keep the eyestrain down. And, in the world of programming, I'm an outright senior citizen (well past my useful shelf-life).
Although not a compulsive font-gatherer, I will rarely pass up a mono-space font.
Thanks, again, for the tip - it'll be useful when I want to spread even more text across the page.
An afterthough: with the eventual takeover of the wide-screen monitors, the large screen widths will make larger fonts more practical - allowing the use of some too-wide-now, but otherwise very nice, fonts.
Balboos
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein
|
|
|
|
|
One of the checkin reasons I use is: "Whitespace fixes."
It says it all how pedantic I am about formatting code.
Some free tips for all of you that love whitespace fixes is to use find/replace (and regex):
Removing whitespace at the end of lines:
Find ":b+$"
Replace with ""
Normalizing whitespace between words:
Find "{[^:b]}:b:b+{[^:b]}"
Replace with "\1 \2"
(Only for my own code that is... I don't go and "fix" other peoples code unless I need to add something in the source file.)
|
|
|
|
|
Phew! And I thought it was just me!
|
|
|
|
|
We should start a club! :P
|
|
|
|
|
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
|
|
|
|