Comments (9)
Variant A is better due to how many nested switch statements are in the code. The alternative would be to have the deepest indent in large essential functions be 3-4 indents deeper than they would have been sticking with variant A, which makes the code less readable. Then for consistency we should keep the rest of the code on the same style.
from pokeheartgold.
I have made several PRs converting style A into style B, which have been approved and merged, and during original style guide discussions, we did decided on style B, so imo style B is better, plus, I prefer it because I personally find it much easier to read
from pokeheartgold.
I prefer style B.
from pokeheartgold.
Style A reinforces the fact that the case labels have no scoping significance and have about the same effect as a goto
label. It's also wasteful to add an indent level when unnecessary.
from pokeheartgold.
I abstain from this discussion.
from pokeheartgold.
There is actually a third variant C: case labels indented by 1, but case contents not indented.
switch (state) {
case 0:
// ...
case 1:
// ...
}
I only mention this because this is the default in Notepad++. With that, I want to mention that editors are inconsistent as to which style they automatically indent to:
Editor | Default behaviour | Toggleable |
---|---|---|
Notepad++ | Variant C | Unknown (Discussion 1, Discussion 2) |
Eclipse (yes this isn't C I know) | Variant A | Yes, see image below |
Visual Studio Code | Variant B | Yes? (Issue which proves its existence in vscode-cpptools extension) |
from pokeheartgold.
There is actually a third variant C: case labels indented by 1, but case contents not indented.
switch (state) { case 0: // ... case 1: // ... }
I only mention this because this is the default in Notepad++. With that, I want to mention that editors are inconsistent as to which style they automatically indent to:
Editor Default behaviour Toggleable
Notepad++ Variant C Unknown (Discussion 1, Discussion 2)
Eclipse (yes this isn't C I know) Variant A Yes, see image below
Visual Studio Code Variant B Yes? (Issue which proves its existence in vscode-cpptools extension)
For eclispe:
objectively bad
from pokeheartgold.
There is actually a third variant C: case labels indented by 1, but case contents not indented.
It's like the worst of both worlds
from pokeheartgold.
I prefer style B.
from pokeheartgold.
Related Issues (20)
- Decide consensus on `idx` vs `index` HOT 6
- Decide consensus on naming of unknown static/global variables. HOT 7
- Style related issues directory
- Decide consensus of naming "cardinality" constants. HOT 31
- Style: State machines should have constants defined for them to make them easier to modify HOT 4
- Replace all instances of `no` as number to `num` or something equivalent
- Replace all instances of idx with index.
- Including msgdata/msg.naix in headers can break other narc decomps
- Fix all struct names to be consistent with the agreed upon style guide.
- Decide consensus on SDK filenames
- Fix up save nomenclature HOT 1
- Add nitrogfx support for NCMP blocks HOT 1
- Decide on usage of comma operator + alignment of bitfields. HOT 4
- Decide on pointer-star alignment for function return types HOT 1
- Decide on name-formatting for move constants HOT 9
- rename false sdk funcs
- Script/Bytecode styling HOT 11
- move overlay files to their own folders HOT 5
- Text printer: "text speed" should instead be "text frame delay" HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pokeheartgold.