|
I'd break the developer's keyboard for that gem.
Charlie Gilley
<italic>You're going to tell me what I want to know, or I'm going to beat you to death in your own house.
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
Gary Wheeler wrote: I'm pretty sure the body will never be found.
We used VSS history tool for postmortem and it significantly reduced the number of causalities.
|
|
|
|
|
Amar Chaudhary wrote: significantly reduced the number of causalities
The effect of that statement is rather profound.
Software Zen: delete this;
|
|
|
|
|
lol, I love this place.
Charlie Gilley
<italic>You're going to tell me what I want to know, or I'm going to beat you to death in your own house.
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
Gary Wheeler wrote: if (condition) DoSomething();
This is what I do 100% of the time with true one-liners.
|
|
|
|
|
if there's a comment
{
//with the line,
it needs a wrapper
}
else if there's an else
{
it also needs a wrapper
}
|
|
|
|
|
My style is somewhat similar. I like symmetrical-looking if-else blocks.
Kevin
|
|
|
|
|
I always try to wrap my BACON.
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
Have a bit more patience with newbies. Of course some of them act dumb -- they're often *students*, for heaven's sake. -- (Terry Pratchett, alt.fan.pratchett)
|
|
|
|
|
Nagy, you have that backwards. BACON can be used to wrap anything.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
|
|
|
|
|
Surely all you need to say is:
Chris Meech wrote: BACON can be used
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
Have a bit more patience with newbies. Of course some of them act dumb -- they're often *students*, for heaven's sake. -- (Terry Pratchett, alt.fan.pratchett)
|
|
|
|
|
Still too wordy:
Chris Meech wrote: BACON
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
if you don't. Manfred made a very good comment earlier that if you want to add any more code then you need to put the braces in anyways.
--
You don't hire a handyman to build a house, you hire a specialist.
|
|
|
|
|
|
Larry Wall rocks!
--
** You don't hire a handyman to build a house, you hire a carpenter.
** Jack of all trades and master of none.
|
|
|
|
|
Slacker007 wrote: if you want to add any more code then you need to put the braces in anyways.
Yeah, I'm not lazy so I wear football safety gear all the time, 'cuse if I want to play football I need to put it anyways.
|
|
|
|
|
It's not wrong to leave a single line code unwrapped under IF. Leads to consistency, uniformity, good practice, blah, blah.
But look at the below scenario:
If ()
sdfsdfsdf;
Else
{
sdfasdfas;
asdfasdfaseasf;
sdfasdfas;
asdfasdfaseasf;
sdfasdfas;
asdfasdfaseasf;
}
Shouldn't the If and else contents be switched? That way I would care less if the one line in else is not wrapped.
-
Just that something can be done, doesn't mean it should be done. Respect developers and their efforts!
Jk
|
|
|
|
|
My personal preference is to do ti always. Although it highly depends on the coding guidelines followed in the project.
"The worst code you'll come across is code you wrote last year.", wizardzz[ ^]
|
|
|
|
|
As I read the question I realise my routine has changed. Previously I considered - is this going to be a single line or not.
Now I just go if(){} ctrl-k,d and then I start to fill out the body as needed.
|
|
|
|
|
Much, much quicker is:
if<tab><tab> which results in:
if (true)
{
}
with the 'true' selected as a replaceable parameter.
ife<tab><tab> gives:
if (true)
{
}
else
{
}
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
I wouldn't let CG touch my Abacus!
When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is.
|
|
|
|
|
It is good pratice and follow it always to wrap any number of lines.
|
|
|
|
|
Consistency is a wonderful thing!
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
And you can always add statements later without having to remember to add the now needed braces.
Cheers!
|
|
|
|
|
I agree with this. Many times I used to confuse with unwrapped single lines
|
|
|
|
|
If you have trouble remembering to add braces after inserting new lines you should consider changing your career.
|
|
|
|
|
And yet, you don't know how to handle braces correctly... I admire you persistence. So tell me how did you get so far, by name calling?
|
|
|
|