commit 576c221eab502dd84e376a1e0f5f0e118c2edb9b
parent bf07aed5326e16e4d3f76d09ad1e8e1e5bfe6e16
Author: Gabriel G. de Brito <gabrielgbrito@icloud.com>
Date: Wed, 23 Oct 2024 18:09:18 -0300
Fuck C++
Diffstat:
2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/content/posts/notes-on-cpp.md b/content/posts/notes-on-cpp.md
@@ -17,6 +17,7 @@ I'll update this rather frequently.
memory every time you copy them. Always keep only a single instance and pass
pointers to it. Yes, this means you have to dynamically allocate them when
they're shared with lower stack frames.
+- Never, ever copy `std::string` also.
- Always reserve space in `std::vector`. Never, ever create one without
reserving sane space first. They usually grow in dumb always, for example
starting at 0 capacity and growing by 50% at each increment, when the sane way
diff --git a/public/posts/notes-on-cpp/index.html b/public/posts/notes-on-cpp/index.html
@@ -69,6 +69,7 @@ Yes. Even the sanest version.</p>
memory every time you copy them. Always keep only a single instance and pass
pointers to it. Yes, this means you have to dynamically allocate them when
they’re shared with lower stack frames.</li>
+<li>Never, ever copy <code>std::string</code> also.</li>
<li>Always reserve space in <code>std::vector</code>. Never, ever create one without
reserving sane space first. They usually grow in dumb always, for example
starting at 0 capacity and growing by 50% at each increment, when the sane way