|
Dan Neely wrote: Some opening braces on their own line; others on the preceding line.
The real question is does the code function properly?
|
|
|
|
|
JimmyRopes wrote: The real question is does the code function properly?
Which part of...
Quote: For my sins I'm investigating the possibility of porting one of my employer's apps to the BB10 platform
... id you not understand?
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, waging all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
--Zachris Topelius
Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies.
-- Sarah Hoyt
|
|
|
|
|
Dan Neely wrote: Which part of...For my sins I'm investigating the possibility of porting one of my employer's apps to the BB10 platform...id you not understand?
I id understand you were porting it to a BB10 platform which makes it important that the code functions properly or you will be porting code that does not meet the functionality of the application.
Which part of...
JimmyRopes wrote: The real question is does the code function properly?
... id you not understand?
|
|
|
|
|
This is our standard "Spot the Asperger" test in interviews.
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
Do not feed the troll ! - Common proverb
|
|
|
|
|
To me there often is much more to get upset on than brace styles. I can deal with every style (as long as it is the same style in the whole module of course).
Meaningless variable names or code with a lot of untreated warnings from the compiler (deserts of trivial to solve warnings hiding the really important one) - that drives me nuts! Brace styles? No, not really...
|
|
|
|
|
jaybus56 wrote: To me there often is much more to get upset on than brace styles
To me anyone that thinks bracing styles makes any difference at all has never worked in any of the industries that I have.
There are a vast array of problems that measurably impact the entire process of delivering a useable piece of software. I can only suppose that people that think braces are significant do not deal with any but code and of course are completely unaware of formatting software.
|
|
|
|
|
This is K&R - other than the if (appPage) not needing braces at all. Nothing wrong here. Move along.
|
|
|
|
|
Well, at least you have braces, they could have resorted to not use braces in the last if.
|
|
|
|
|
This is silly nonsense. It's common in K&R style to put the opening brace of the function on its own line.
|
|
|
|
|
The only answer is to switch to Fortran. If you still complain about K&R style after that, then you are far more resilient than I.

|
|
|
|
|
Hmmmm would writing a mobile app in Fortran get me 15 minutes of fame by getting to the front page of hacker news?
I'd say no, except that the person who wrote a web server framework in COBOL[^] succeeded.
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, waging all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
--Zachris Topelius
Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies.
-- Sarah Hoyt
|
|
|
|
|
|
I just wish all Version Control Systems would allow us to chose the brace formatting, as well as other formatting, and check the code out into the format we like and check it back in as the company standard. Then this battle could end. 
|
|
|
|
|
K&R C was developed in the days when the Teletype ASR 33 was the standard keyboard/printer/paper tape reader/punch. The ASR 33 read and printed AT 10 CHARACTERS PER SECOND. Since it could take hours to compile and print a program listing, brevity was paramount. Spaces were important since each space took a 1/10 of a second to process; tabs were not usually used because tab settings were not consistent; and the program author was the maintainer, so understanding and style consistency were already learned.
IMHO, C, C++, Java, JavaScript, and all their derivative languages are innately prone to error.
I have spent countless unnecessary hours chasing non-obvious programming errors. In one case, I spent over 6 months chasing an "=" vs "==" in an if statement in a C program that was buried in an error recovery routine.
Programs should be written, first for communications to yourself; second, to other programmers; and finally to the equipment. And part of communications is consistency in style.
At last count, I have written programs and systems in over 40 languages, some of which where proprietary to equipment or application. They all have room for improvement!
Just my thoughts
|
|
|
|
|
I normally put the opening brace on the introductory statement line, but there are a number of functions I've written that do not follow this rule: those auto-generated by tools, and those that have too many arguments to put on one line. In the latter case, the main problem is that auto-formatting would not indent follow-up code correctly if I placed the opening brace on the last line of the argument list. But formatting works fine if I put it on a separate line.
Life is compromise
(yes, it's totally possible there are formatting tools better than the built-in VS editor, but I'm not going to clutter my toolbox just for this!)
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|
|
Get resharper on that code right away!!
|
|
|
|
|
I was outside doing some work when I noticed that the tulips and daffodils are coming up. What a great winter we are having
Within you lies the power for good - Use it!
|
|
|
|
|
Damn, it's hell on wheels here in hamster land. -20 to -30C seems to be the norm.
/ravi
|
|
|
|
|
Ravi Bhavnani wrote: in hamster land.
Strange - don't you normally get Tulips from hamster land?
MVVM # - I did it My Way
___________________________________________
Man, you're a god. - walterhevedeich 26/05/2011
.\\axxx
(That's an 'M')
|
|
|
|
|
Good catch! Clearly I have food on the brain.
/ravi
|
|
|
|
|
Wow, that's awesome. Well played sir.
|
|
|
|
|
Yes - we have flowers blooming as well. "Crocuses" apparently - I only recognize two forms of plant: "Grass" and "Tree". Everything else is a complication I leave to Herself.
I will (under duress) mow the grass, but I draw the line at anything else.
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
OriginalGriff wrote: I will (under duress) mow the grass, but I draw the line at anything else. I draw the line at sand.
/ravi
|
|
|
|
|
Here in SC and in FL as well snow is on the way Weds. and wind chills in the low teens, last time this happened was in 89!
|
|
|
|
|
Back in 2004, the Upstate region of South Carolina (Rock Hill specifically) got a snow storm in February - 18 inches in one day. What would have been a 45 minute commute home took 3 hours.
And, no, it doesn't happen very often, but when it does... well, just stay off the roads. Even if YOU know how to drive in it, MOST of them don't.
Tim
|
|
|
|