commit 035934f88e198e82d907617f68cf2aa8dc7f85ad
parent 0e2a274b5ccc24a2ebfdaacfd20a89df6a2b7f47
Author: Gabriel G. de Brito <gabrielgbrito@icloud.com>
Date: Mon, 28 Oct 2024 16:26:40 -0300
Fuck std::vector
Diffstat:
2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/content/posts/notes-on-cpp.md b/content/posts/notes-on-cpp.md
@@ -31,3 +31,5 @@ I'll update this rather frequently.
God help you) need typeinfo for a non-polymorphic class, you must use a
placeholder USELESS virtual function like `virtual void
ImAClownForCodingInThisShittyLanguage()`.
+- When you have a `std::vector<T>`, passing a `T*` to it's `push_back()` method
+ may compile without errors and fuck you a lot.
diff --git a/public/posts/notes-on-cpp/index.html b/public/posts/notes-on-cpp/index.html
@@ -79,6 +79,11 @@ newline will flush a life-buffered output stream anyways, and you definitely
don’t want to force flush a file output.</li>
<li>Avoid <code>static</code> duration objects as their initialization and termination
processes happens at a not well-defined time.</li>
+<li>Classes only have RTTI when they’re virtual, so, if, for some reason, you (May
+God help you) need typeinfo for a non-polymorphic class, you must use a
+placeholder USELESS virtual function like <code>virtual void ImAClownForCodingInThisShittyLanguage()</code>.</li>
+<li>When you have a <code>std::vector<T></code>, passing a <code>T*</code> to it’s <code>push_back()</code> method
+may compile without errors and fuck you a lot.</li>
</ul>
</div>