Skip to content

Update style guide#10461

Merged
laanwj merged 1 commit intobitcoin:masterfrom
sipa:stylish
May 31, 2017
Merged

Update style guide#10461
laanwj merged 1 commit intobitcoin:masterfrom
sipa:stylish

Conversation

@sipa
Copy link
Member

@sipa sipa commented May 26, 2017

As discussed in this week's IRC meeting.

@practicalswift
Copy link
Contributor

ACK 47d8441

Very good! Thanks for clarifying!

- Global variables have a `g_` prefix.
- Constant names are all uppercase, and use `_` to separate words.
- Class names, function names and method names are CamelCase. Do not prefix
class names with `C`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not prefix class names with C?

@sipa
Copy link
Member Author

sipa commented May 29, 2017

It is always obvious from the usage that a name refers to a class and not a function/method, so no need to repeat that information in the name.

@luke-jr
Copy link
Member

luke-jr commented May 29, 2017

Is it? function(0, class()) seems fairly non-obvious.

@gmaxwell
Copy link
Contributor

Seems fine to me.

- Class member variables have a `m_` prefix.
- Global variables have a `g_` prefix.
- Constant names are all uppercase, and use `_` to separate words.
- Class names, function names and method names are CamelCase. Do not prefix
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we had a discussion about that already:
I often saw projects where the static class methods and global space functions where in UpperCamelCase() while the class methods where in lowerCamelCase() and I think this is useful.
But no strong opinion.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except for the qt code, this just documents the style already in use.
So while this sounds sensible for a new project, I don't think we should change this now.

@jonasschnelli
Copy link
Contributor

ACK 47d8441

style over attempting to mimick the surrounding style, except for move-only
commits.

Do not submit patches solely to modify the style of existing code.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this explicitly 👍

@laanwj
Copy link
Member

laanwj commented May 31, 2017

utACK 47d8441

@laanwj laanwj merged commit 47d8441 into bitcoin:master May 31, 2017
laanwj added a commit that referenced this pull request May 31, 2017
47d8441 Update style guide (Pieter Wuille)

Tree-SHA512: 0b11365f294eeda1ea5c45cf04b3f38435602f61edc0c605e067ed9d17d17c28e9f1dd76bd4fa8a630e9cec8c5103cd2bfe5f6097196761d576913d9180f2ecf
@jtimon
Copy link
Contributor

jtimon commented Jun 1, 2017

ACK

@sipa sipa deleted the stylish branch June 23, 2017 00:35
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Dec 9, 2019
47d8441 Update style guide (Pieter Wuille)

Tree-SHA512: 0b11365f294eeda1ea5c45cf04b3f38435602f61edc0c605e067ed9d17d17c28e9f1dd76bd4fa8a630e9cec8c5103cd2bfe5f6097196761d576913d9180f2ecf
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 2, 2020
47d8441 Update style guide (Pieter Wuille)

Tree-SHA512: 0b11365f294eeda1ea5c45cf04b3f38435602f61edc0c605e067ed9d17d17c28e9f1dd76bd4fa8a630e9cec8c5103cd2bfe5f6097196761d576913d9180f2ecf
gades pushed a commit to cosanta/cosanta-core that referenced this pull request Jun 30, 2021
47d8441 Update style guide (Pieter Wuille)

Tree-SHA512: 0b11365f294eeda1ea5c45cf04b3f38435602f61edc0c605e067ed9d17d17c28e9f1dd76bd4fa8a630e9cec8c5103cd2bfe5f6097196761d576913d9180f2ecf
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants