~kris/9p

krisyotam.net

krisyotam.net/d/notes/takes-on-cpp.html -rw-r--r-- 4.1 KiB
8bfa4b74 — Kris Yotam ci: declare SourceHut source for push builds a month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Takes on C++ | Kris Yotam</title>
    <link rel="stylesheet" href="../../c/site.css">
    <meta name="description" content="Guidelines for modern C++ usage, including style, idioms, and version-specific practices">
    <meta name="viewport" content="width=device-width, initial-scale=1">
  </head>
  <body>
    <div class="mode-container">
      <input type="radio" name="theme" id="theme-auto" checked>
      <label for="theme-auto" class="auto" title="Auto theme"></label>
      <input type="radio" name="theme" id="theme-light">
      <label for="theme-light" class="light" title="Light theme"></label>
      <input type="radio" name="theme" id="theme-dark">
      <label for="theme-dark" class="dark" title="Dark theme"></label>
    </div>
    <div class="top-bar" role="navigation">
      <a href="../../index.html" title="Main page"><img src="../../c/sigma.svg" alt="Main page"></a>
      <a href="../../about.html" title="About"><img src="../../c/news.svg" alt="About"></a>
      <a href="#" title="Code"><img src="../../c/code.svg" alt="Code"></a>
      <a href="../../pics.html" title="Photography"><img src="../../c/camera.svg" alt="Photography"></a>
      <a href="#" title="Pictures"><img src="../../c/picture.svg" alt="Pictures"></a>
      <a href="../../vids.html" title="Videos"><img src="../../c/video.svg" alt="Videos"></a>
      <a href="#" title="Donations"><img src="../../c/beer.svg" alt="Donations"></a>
      <a href="#" title="Social"><img src="../../c/elephant.svg" alt="Social"></a>
    </div>
    <h1>Takes on C++</h1>
    <div class="keepws">
(<span class="bold">notes</span>
  (date 2025-06-29)
  (category <a href="../../notes.html">manuals-of-style</a>)
  (status <span class="status-evergreen">evergreen</span>)
  (confidence certain)
  (importance 5)
  (tags reflection programming cpp))
    </div>
    <p class="preview">Guidelines for modern C++ usage, including style, idioms, and version-specific practices</p>
    <div class="prose">
<p>For those wondering I intend on using C++ strictly for competitive programming. I am learning C, Python, and Bash to take care off a number
of other issues such as my planned open source contributions, scripting, and data analysis. So while I may have a abundance of usecases that arise for the C++ language at a later date.
The state of this guide is for practical C++ use in Competitive Programming.</p>
<p>I have not completely decided on how I will split my time or the practice of certain languages and on which platforms. However you can currently find me on the platforms
below which over the next year (05/04/2025) should all see at least some use.</p>
<ul>
<li><a href="">CodeForces</a></li>
<li><a href="">CodeChef</a></li>
<li><a href="https://atcoder.jp/users/khr1st">AtCoder</a></li>
<li><a href="https://www.hackerrank.com/profile/krisofakind">HackerRank</a></li>
<li><a href="https://leetcode.com/u/khr1st/">LeetCode</a></li>
</ul>
<p>I have abstracted my <a href="/blog/2025/a-manifesto-for-holistic-computing">coding philosophy</a> into a post that covers my philosophy for hardware, software, and coding as these tend to be language independant frameworks.</p>
<h2>C++ Style Guide</h2>
<p>A comprehensive guide to writing clean and efficient C++ code.</p>
<h3>Interactive Code Examples</h3>
<p>Below is an example of a simple algorithm implemented in C++.</p>
<h3>Proper Formatting</h3>
<p>The code above follows key C++ formatting guidelines:</p>
<ul>
<li>Consistent indentation (2 or 4 spaces)</li>
<li>Proper spacing around operators</li>
<li>Clear function and variable names</li>
<li>Appropriate comments for complex logic</li>
</ul>
<pre><code>// Example function in C++
int add(int a, int b) {
return a + b;
}
</code></pre>
<h3>Interactive Family Tree Visualization</h3>
<p>Below is an experimental integration of our new genealogy component. This family tree shows key members of the Rothschild banking dynasty, starting with the founder Mayer Amschel Rothschild. Click on individual family members to see more details or use the expand button to view the full tree.</p>
    </div>
  </body>
</html>