<p>These classes predate the coding style guidelines. Guidelines are a recommendation for newly added code and refactoring patches for the purpose of only changing the coding style are discouraged.</p>
<p>In the plain words of <a href="https://github.com/bitcoin/bitcoin/blob/5fca70f5b16fee4a732a1d7fd3fb1c7e775decdf/doc/developer-notes.md#coding-style-general" rel="noreferrer">the introduction of the document you link</a>:</p>
<blockquote>
<p>Various coding styles have been used during the history of the codebase, and the result is not very consistent. However, we're now trying to converge to a single style, which is specified below. When writing patches, favor the new style over attempting to mimic the surrounding style, except for move-only commits.</p>
<p>Do not submit patches solely to modify the style of existing code.</p>
</blockquote>

CC BY-SA 4.0
2023-04-18T08:37:37.517Z
2023-04-18T08:37:37.517Z
Antoine Poinsot
<p>It's part of the developer notes in the documentation of Bitcoin Core:</p>
<blockquote>
<p>Class names, function names, and method names are UpperCamelCase
(PascalCase). Do not prefix class names with <code>C</code>. See Internal interface
naming style for an exception to this convention.</p>
</blockquote>
<p><a href="https://github.com/bitcoin/bitcoin/blob/5fca70f5b16fee4a732a1d7fd3fb1c7e775decdf/doc/developer-notes.md#coding-style-c" rel="nofollow noreferrer">Link</a></p>
<p>But I've seen many places in the codebase classes' name starting by <code>C</code>.
Such as:</p>
<ul>
<li><code>CBlock</code></li>
<li><code>CTransaction</code></li>
<li><code>CTxIn</code></li>
<li><code>CTxOut</code></li>
<li><code>COutPoint</code></li>
</ul>
<p>And many other examples. Is there a progress currently for changing these names? Or this rule is not apply to some classes?</p>
<p>Note that there's no description for this inconsistency in <a href="https://github.com/bitcoin/bitcoin/blob/5fca70f5b16fee4a732a1d7fd3fb1c7e775decdf/doc/developer-notes.md#internal-interface-guidelines" rel="nofollow noreferrer">this part</a> of the doc.</p>

CC BY-SA 4.0
2023-04-18T08:59:13.100Z
Related question: https://bitcoin.stackexchange.com/questions/106558/what-do-the-classes-chainstatemanager-cchainstate-cchain-and-blockmanager-do-i
Michael Folkson
<bitcoin-core-development><c++>
Why many classes in the Bitcoin Core prefix with a `C` while it is prohibited in the developer notes?
Amir reza Riahi
# Why many classes in the Bitcoin Core prefix with a `C` while it is prohibited in the developer notes?

(Asked by: username_0 on 2023-04-18)

It's part of the developer notes in the documentation of Bitcoin Core:

> Class names, function names, and method names are UpperCamelCase
> (PascalCase). Do not prefix class names with `C`. See Internal interface
> naming style for an exception to this convention.

[Link](https://github.com/bitcoin/bitcoin/blob/5fca70f5b16fee4a732a1d7fd3fb1c7e775decdf/doc/developer-notes.md#coding-style-c)

But I've seen many places in the codebase classes' name starting by `C`.
Such as:

* `CBlock`
* `CTransaction`
* `CTxIn`
* `CTxOut`
* `COutPoint`

And many other examples. Is there a progress currently for changing these names? Or this rule is not apply to some classes?

Note that there's no description for this inconsistency in [this part](https://github.com/bitcoin/bitcoin/blob/5fca70f5b16fee4a732a1d7fd3fb1c7e775decdf/doc/developer-notes.md#internal-interface-guidelines) of the doc.

**Tags:** bitcoin-core-development, c++

> **Comments:**
> **username_1**: Related question: https://bitcoin.stackexchange.com/questions/106558/what-do-the-classes-chainstatemanager-cchainstate-cchain-and-blockmanager-do-i  

---

## 1 answers

### Answer by username_2 on 2023-04-18. Score: 14 | Accepted answer

These classes predate the coding style guidelines. Guidelines are a recommendation for newly added code and refactoring patches for the purpose of only changing the coding style are discouraged.

In the plain words of [the introduction of the document you link](https://github.com/bitcoin/bitcoin/blob/5fca70f5b16fee4a732a1d7fd3fb1c7e775decdf/doc/developer-notes.md#coding-style-general):

> Various coding styles have been used during the history of the codebase, and the result is not very consistent. However, we're now trying to converge to a single style, which is specified below. When writing patches, favor the new style over attempting to mimic the surrounding style, except for move-only commits.
>
> Do not submit patches solely to modify the style of existing code.


---

