|
You're not doomed. You just won't get dinner and a movie.
|
|
|
|
|
For someone too lazy to look it up, what’s the diff?
edit============
Never mind - I looked it up, and I use allman... I never knew there was a name for it
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
modified 21-Feb-21 16:36pm.
|
|
|
|
|
K&R: left brace goes at the end of the line
Allman: left brace goes on its own line, not indented from previous line
|
|
|
|
|
There's a good summary of all the styles here:
Indentation style - Wikipedia[^]
I always thought my braces style was unique: Now I see it even has a name (Allman). Well, you live and sometimes you even learn!
Get me coffee and no one gets hurt!
|
|
|
|
|
Upvote for teaching me something!
Get me coffee and no one gets hurt!
|
|
|
|
|
Brian Kernighan is a man.
Dennis Ritchie is a man.
Hence K&R consists of only men.
QED
K&R braces are All-man braces.
Problem solved.
If you can't laugh at yourself - ask me and I will do it for you.
|
|
|
|
|
Bonus points for a delightfully contrary reply!
Software Zen: delete this;
|
|
|
|
|
Since I took up Visual Studio, I've been programming C#. In C# context, there is no similar issues: You just set up the line break, indentation rules and bracing style you want, delete and retype the closing brace, and that is it.
I assume that VS can do the same for C / C++ code.
Sure, if your source file style is to make every function, no matter how tiny, into its own source file (with typically 60 lines of copyleft, 20 lines of #include and 10 lines of C code), then you probably have a several thousand files to open. All C++ code I have been handling had the entire class definition, with all its methods, in a single file. If you have several thousand classes, then you are talking about a huge system! (Or possibly a poorly chosen class structure.)
|
|
|
|
|
Gary R. Wheeler wrote: I'm doomed.
clang format.
|
|
|
|
|
That's easy. Just run your compiled exe through a decompiler and you will have consistent braces
|
|
|
|
|
[Puts on asbestos suit]
Now this won't be popular but C style languages have irritated me since the 80s. Probably something to do with being taught that the future of programming (I also dislike the word "coding" for similar reasons) would involve natural language and a specification of the problem rather than the solution.
In line with that (puts on 2nd asbestos suit) more "verbose" languages (e.g. COBOL or later, VB!) seemed to make sense and I never fully understood people's reaction that something was "too verbose."
However, when a conversation involves how to space punctuation marks, I think the point is made for me!
|
|
|
|
|
Autocomplete/intellisense has made me less concerned about brevity but when I was coding in the 1980s and 1990s I found it helpful that C and C++ didn't saddle me with a bunch of redundant text to wear down my fingers with.
Real programmers use butterflies
|
|
|
|
|
A fair point, but there were examples of keyboard shortcuts to save typing the whole word, depending what you were using.
|
|
|
|
|
REMOVE ASBESTOS SUITS AND BURN THE HERETIC!
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
Hopefully the Burn function will accept a delegate as input. If only I could remember what shape brackets to use for that ...
|
|
|
|
|
#define begin {
#define end } Problem solved, at least in C and C++.
C#, not so much unless you use one of the add-on preprocessors I've seen wandering about.
Software Zen: delete this;
|
|
|
|
|
55" 4k QLED monitor
Ryzen 7 16-hw threads with NVMe and 32GB of RAM
A custom built, convenient solderless hardware development platform I built specially for ESP32 boards, sitting under a brilliant little led magnifying lamp
wired up via USB to my desk mounted backlit 11 port USB3x powered hub
Interfacing with a backlit gaming keyboard just to keep a little ambient desk lighting even at 6am like now when it's otherwise dark here.
It's finally everything I could have wanted - a computer I can't keep up with, a screen with more real estate than i even really need, where everything is as crisp as it is on my phone, complimented by a work desk where I can quickly wire up USB powered IoT widgets that I can actually see to build without bifocals - All the hardware above working brilliantly in tandem to give me a marvelous experience.
I'm such a nerd that I get thrilled by something like this but oh well.
My development lair is complete.
I'm sure I'll find ways to improve on it eventually, but right now it's more than I could have hoped for. The last time I remember feeling that way about my dev environment was when I went from being a couch surfing teenager hacking on whatever i had available to working at the Microsoft corporate monster where I had a fancy professional workstation - a paycheck with a reliable place to sleep at night - and someone else to worry about IT.
So I'm pretty excited about it.
Real programmers use butterflies
|
|
|
|
|
I'm very pleased with my new LED nightlight with PIR sensor that turns on when I go upstairs early in the morning to my home office. No more stumbling around in the dark on the stairs!
|
|
|
|
|
Technology is elephanting amazing.
Real programmers use butterflies
|
|
|
|
|
It is nice to live in the future!
If you can't laugh at yourself - ask me and I will do it for you.
|
|
|
|
|
All you are missing is (a) a retractable lighting rod, and (b) an assistant called Igor.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
Well I do have a broomstick and a black cat.
Real programmers use butterflies
|
|
|
|
|
And a butler named Willikins.
|
|
|
|
|
But can it run Crysis?
|
|
|
|
|
What's that?
It runs games fine, unless you try to run them at 4k. Then it gets like 20-30FPS depending on the game.
Real programmers use butterflies
|
|
|
|