<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Hacker News: pfultz2</title><link>https://news.ycombinator.com/user?id=pfultz2</link><description>Hacker News RSS</description><docs>https://hnrss.org/</docs><generator>hnrss v2.1.1</generator><lastBuildDate>Sat, 25 Apr 2026 22:24:08 +0000</lastBuildDate><atom:link href="https://hnrss.org/user?id=pfultz2" rel="self" type="application/rss+xml"></atom:link><item><title><![CDATA[New comment by pfultz2 in "Safety: A comparaison between Rust, C++ and Go"]]></title><description><![CDATA[
<p>Yea and C++ static analysis tools already warn for the case, so even for new C++ programmers where it might not be entirely obvious, its still easy to catch the error.</p>
]]></description><pubDate>Sat, 30 Jul 2022 17:52:51 +0000</pubDate><link>https://news.ycombinator.com/item?id=32288791</link><dc:creator>pfultz2</dc:creator><comments>https://news.ycombinator.com/item?id=32288791</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=32288791</guid></item><item><title><![CDATA[New comment by pfultz2 in "Safety: A comparaison between Rust, C++ and Go"]]></title><description><![CDATA[
<p>You dont need annotations, cppcheck already warns with:<p><pre><code>    test.cpp:16:45: error: Using object that is a temporary. [danglingTemporaryLifetime]
        assert((std::vector<int>{1, 2, 3, 4} == append34({1, 2}))); // FAIL: UB
                                                ^
    test.cpp:3:12: note: Return lambda.
        return [&](std::vector<int>&& items) {
               ^
    test.cpp:2:50: note: Passed to reference.
    auto make_appender(std::vector<int> const& suffix) {
                                                     ^
    test.cpp:4:36: note: Lambda captures variable by reference here.
            return append(move(items), suffix);
                                       ^
    test.cpp:15:35: note: Passed to 'make_appender'.
        auto append34 = make_appender({3, 4});
                                      ^
    test.cpp:15:35: note: Temporary created here.
        auto append34 = make_appender({3, 4});
                                      ^
    test.cpp:16:45: note: Using object that is a temporary.
        assert((std::vector<int>{1, 2, 3, 4} == append34({1, 2}))); // FAIL: UB</code></pre></p>
]]></description><pubDate>Sat, 30 Jul 2022 17:41:22 +0000</pubDate><link>https://news.ycombinator.com/item?id=32288699</link><dc:creator>pfultz2</dc:creator><comments>https://news.ycombinator.com/item?id=32288699</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=32288699</guid></item><item><title><![CDATA[New comment by pfultz2 in "Type Erasure in C++ Explained"]]></title><description><![CDATA[
<p>Concepts specify constraints on templates, but the types are still templates, so you can't put the function definition in a .cpp file nor put them into a vector(which is what type erasure allows).</p>
]]></description><pubDate>Thu, 15 Apr 2021 19:07:32 +0000</pubDate><link>https://news.ycombinator.com/item?id=26824851</link><dc:creator>pfultz2</dc:creator><comments>https://news.ycombinator.com/item?id=26824851</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=26824851</guid></item><item><title><![CDATA[New comment by pfultz2 in "Type Erasure in C++ Explained"]]></title><description><![CDATA[
<p>That seems more like type erasure as defined in Java where the container is the same for all data types and the compiler implicitly inserts casts from the base type to the parameter type.</p>
]]></description><pubDate>Thu, 15 Apr 2021 18:38:39 +0000</pubDate><link>https://news.ycombinator.com/item?id=26824495</link><dc:creator>pfultz2</dc:creator><comments>https://news.ycombinator.com/item?id=26824495</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=26824495</guid></item><item><title><![CDATA[New comment by pfultz2 in "Why the C++ standard ships every three years"]]></title><description><![CDATA[
<p>But cppcheck can find a lot of dangling references with lambda captures.</p>
]]></description><pubDate>Sun, 14 Jul 2019 00:36:14 +0000</pubDate><link>https://news.ycombinator.com/item?id=20430962</link><dc:creator>pfultz2</dc:creator><comments>https://news.ycombinator.com/item?id=20430962</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=20430962</guid></item><item><title><![CDATA[New comment by pfultz2 in "Modern C++ Won't Save Us"]]></title><description><![CDATA[
<p>Clang's lifetime profile will catch the first example:<p><pre><code>    <source>:8:16: warning: passing a dangling pointer as argument [-Wlifetime]
      std::cout << sv;
                   ^

    <source>:7:38: note: temporary was destroyed at the end of the full expression
      std::string_view sv = s + "World\n";
                                         ^
</code></pre>
And cppcheck will catch the second example:<p><pre><code>    <source>:7:12: warning: Returning lambda that captures local variable 'x' that will be invalid when returning. [returnDanglingLifetime]
        return [&]() { return *x; };
               ^
    <source>:7:28: note: Lambda captures variable by reference here.
        return [&]() { return *x; };
                               ^
    <source>:6:49: note: Variable created here.
    std::function<int(void)> f(std::shared_ptr<int> x) {
                                                    ^
    <source>:7:12: note: Returning lambda that captures local variable 'x' that will be invalid when returning.
        return [&]() { return *x; };
               ^</code></pre>
Cppcheck could probably catch all the examples, but it needs to be updated to understand the newer classes in C++.</p>
]]></description><pubDate>Tue, 23 Apr 2019 02:07:21 +0000</pubDate><link>https://news.ycombinator.com/item?id=19725018</link><dc:creator>pfultz2</dc:creator><comments>https://news.ycombinator.com/item?id=19725018</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=19725018</guid></item><item><title><![CDATA[New comment by pfultz2 in "Show HN: Xmake, a modern C/C++ build utility"]]></title><description><![CDATA[
<p>Meson looks nice, but it still lacks a way to tell it where your dependencies are installed(like cmake’s CMAKE_PREFIX_PATH). You can try to get by, by setting pkg config path, but it doesn’t help for dependencies that don’t support pkgconfig.</p>
]]></description><pubDate>Tue, 09 Apr 2019 02:36:42 +0000</pubDate><link>https://news.ycombinator.com/item?id=19611253</link><dc:creator>pfultz2</dc:creator><comments>https://news.ycombinator.com/item?id=19611253</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=19611253</guid></item><item><title><![CDATA[New comment by pfultz2 in "Comparing Pythagorean triples in C++, D, and Rust"]]></title><description><![CDATA[
<p>> For the sake of history, `range` was found/coined by Andrei<p>No it wasn't. Boost.Range library predates Andrei's Range talk in 2009. Boost.Range was introduced in boost 1.32, which was released in 2004:<p><a href="https://www.boost.org/users/history/version_1_32_0.html" rel="nofollow">https://www.boost.org/users/history/version_1_32_0.html</a><p>And from Boost.Range's "History and Acknowledgement" it explains where the term came from:<p>> The term Range was adopted because of paragraph 24.1/7 from the C++ standard<p><a href="https://www.boost.org/doc/libs/1_32_0/libs/range/doc/history_ack.html" rel="nofollow">https://www.boost.org/doc/libs/1_32_0/libs/range/doc/history...</a><p>Furthermore, what is being standardized in C++ is an expansion of what is in Boost.Range, which uses iterators underneath.<p>Andrei's term for ranges(and what is in D) are actually quite different as it removes the basis for iterators completely.</p>
]]></description><pubDate>Mon, 31 Dec 2018 20:40:51 +0000</pubDate><link>https://news.ycombinator.com/item?id=18796869</link><dc:creator>pfultz2</dc:creator><comments>https://news.ycombinator.com/item?id=18796869</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=18796869</guid></item><item><title><![CDATA[New comment by pfultz2 in "How America lost its love for the stick shift"]]></title><description><![CDATA[
<p>Higher density may allow for more volume but it can increase viscosity.</p>
]]></description><pubDate>Wed, 12 Sep 2018 07:16:46 +0000</pubDate><link>https://news.ycombinator.com/item?id=17966200</link><dc:creator>pfultz2</dc:creator><comments>https://news.ycombinator.com/item?id=17966200</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=17966200</guid></item><item><title><![CDATA[New comment by pfultz2 in "Modern CMake short tutorial and best practice"]]></title><description><![CDATA[
<p>Daniel Pfeffier’s effective cmake talks about how to do that. Setup each project standalone and get the dependencies with find_package. Then create a superprojects thats add each dependency with add_subdirectory and override find_package to be a no-op for dependencies added with add_subdirectory, since the “imported” target is already part of the build:<p><a href="https://m.youtube.com/watch?v=bsXLMQ6WgIk" rel="nofollow">https://m.youtube.com/watch?v=bsXLMQ6WgIk</a><p>Now, overriding a builtin function is not the best idea so in boost cmake modules we have a bcm_ignore_package function which will setup find_package to ignore the package :<p><a href="http://bcm.readthedocs.io/en/latest/src/BCMIgnorePackage.html#bcm-ignore-package" rel="nofollow">http://bcm.readthedocs.io/en/latest/src/BCMIgnorePackage.htm...</a></p>
]]></description><pubDate>Sun, 27 May 2018 01:01:58 +0000</pubDate><link>https://news.ycombinator.com/item?id=17164970</link><dc:creator>pfultz2</dc:creator><comments>https://news.ycombinator.com/item?id=17164970</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=17164970</guid></item><item><title><![CDATA[New comment by pfultz2 in "C++ and the Culture of Complexity (2013)"]]></title><description><![CDATA[
<p>> What does that do? It makes the variable x refer to the object that y is referring to<p>In Java/C#, it doesn't always:<p>int x = 1;
int y = 2;
x = y;<p>The variable `x` does not refer to the object that `y` is referring to(as there is no reference involved at all).<p>Assignment is a procedure that makes `x` equal to `y` without modifying `y`.  However, if `x` refers to `y`, then we can modify `y` after assignment to `x`. This destroys the ability to reason locally about the code, because each object essentially becomes as good as a global variable.<p>Even though C++ has areas where things gets complicated, this is the one thing that C++ keeps very simple and consistent. There is only one definition of copy, assignment, and equality, whereas in java there is multiple definitions(deep copy vs shallow copy, `==` vs `.equals`).<p>> That’s called value semantics, although I would prefer the term state semantics: objects do not have a value, they have state, and that’s what’s being transferred here.<p>No. Its value semantics, as these objects represent some entity. The interpretation of the state(or datum to be more precise) is the known as the object's value. For example, when copying a `std::vector` the internal state of the vector will be different on copy, as it will point to new piece of memory, however, its value will still be the same.<p>> But experience shows that making a copy of an object is hard.<p>The compiler already generates a copy constructor and assignment for you. Its only necessary to write one, when one is dealing with low-level pointers. Using the standard built-in types and containers, writing a copy constructor is never needed.</p>
]]></description><pubDate>Wed, 31 Jan 2018 17:51:15 +0000</pubDate><link>https://news.ycombinator.com/item?id=16275804</link><dc:creator>pfultz2</dc:creator><comments>https://news.ycombinator.com/item?id=16275804</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=16275804</guid></item><item><title><![CDATA[New comment by pfultz2 in "Does C++ need a universal package manager?"]]></title><description><![CDATA[
<p>> Currently there is no buildsystem that enables users to describe the requirements of an project correctly.<p>We want to steer away from standardizing a build system for now. The uses cases are enormous to try to tackle. Instead, it would be simpler to standardized the description of the build environment so the package manager can pass that to the build system.<p>Hopefully, build systems will be updated to read the package metadata so it can properly consume the dependencies correctly.<p>> So yes - I'm convinced a metadata file as you suggested is the way to go.<p>Good to know we are on the right track.</p>
]]></description><pubDate>Wed, 01 Nov 2017 03:23:50 +0000</pubDate><link>https://news.ycombinator.com/item?id=15598602</link><dc:creator>pfultz2</dc:creator><comments>https://news.ycombinator.com/item?id=15598602</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=15598602</guid></item><item><title><![CDATA[New comment by pfultz2 in "Does C++ need a universal package manager?"]]></title><description><![CDATA[
<p>The package managers that are listed in the post are cross-platform and work on windows.</p>
]]></description><pubDate>Sun, 29 Oct 2017 22:28:18 +0000</pubDate><link>https://news.ycombinator.com/item?id=15581852</link><dc:creator>pfultz2</dc:creator><comments>https://news.ycombinator.com/item?id=15581852</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=15581852</guid></item><item><title><![CDATA[New comment by pfultz2 in "Does C++ need a universal package manager?"]]></title><description><![CDATA[
<p>Or rather, I would like to hear your opinion instead. Would buckaroo consider using a standard package metadata similar to what I outlined?<p>I believe buckaroo uses integrated builds so its likely you would need to supplement it with other information such as source files, but hopefully the core information could be reused.</p>
]]></description><pubDate>Sun, 29 Oct 2017 20:31:32 +0000</pubDate><link>https://news.ycombinator.com/item?id=15581253</link><dc:creator>pfultz2</dc:creator><comments>https://news.ycombinator.com/item?id=15581253</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=15581253</guid></item><item><title><![CDATA[New comment by pfultz2 in "Does C++ need a universal package manager?"]]></title><description><![CDATA[
<p>> I'm surprised the author forgot to consider platform architectures<p>That is mainly for binary distribution. Most C++ package managers currently are source-based because binary compatibility is not a easy problem(there are some package managers trying to solve it though).<p>> Unfortunately, it is still terribly easy to write non-portable code with C++<p>Yes, it easy to call into a platform-specific API, so cross-platform portability is limited by the testing resources for the package maintainer or library author.</p>
]]></description><pubDate>Sun, 29 Oct 2017 20:24:40 +0000</pubDate><link>https://news.ycombinator.com/item?id=15581217</link><dc:creator>pfultz2</dc:creator><comments>https://news.ycombinator.com/item?id=15581217</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=15581217</guid></item><item><title><![CDATA[New comment by pfultz2 in "Does C++ need a universal package manager?"]]></title><description><![CDATA[
<p>> Wonder if Nix package manager would work here.<p>The problem is extra work is needed to support things like cross compilation.<p>Instead, you want to pass a toolchain file that describes the build environment(including for cross-compilation) to the build system, and it will compile it correctly for the target. This is the way cmake works, but we should have standard toolchain file that can be used across all build systems instead of requiring everyone to use cmake.</p>
]]></description><pubDate>Sun, 29 Oct 2017 20:18:09 +0000</pubDate><link>https://news.ycombinator.com/item?id=15581176</link><dc:creator>pfultz2</dc:creator><comments>https://news.ycombinator.com/item?id=15581176</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=15581176</guid></item><item><title><![CDATA[New comment by pfultz2 in "Post a boarding pass on Facebook, get your account stolen"]]></title><description><![CDATA[
<p>You can't do that with United Airlines. The answers have to be picked from a drop-down of answers.</p>
]]></description><pubDate>Sat, 23 Sep 2017 20:19:33 +0000</pubDate><link>https://news.ycombinator.com/item?id=15321509</link><dc:creator>pfultz2</dc:creator><comments>https://news.ycombinator.com/item?id=15321509</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=15321509</guid></item><item><title><![CDATA[New comment by pfultz2 in "Build2 – A C++ Build Toolchain and Package Manager"]]></title><description><![CDATA[
<p>Last time I looked at Nix it had a problem with dealing with cross-compilation. The problem is mainly that many packages still use autotools which does not have a descriptive toolchain. Ultimately, it could provide a descriptive toolchain and then map that toolchain to the different build systems, which is similar to what cget does, but perhaps a separate tool to do this could be helpful so this could be shared among different package managers.</p>
]]></description><pubDate>Fri, 05 May 2017 08:52:40 +0000</pubDate><link>https://news.ycombinator.com/item?id=14272027</link><dc:creator>pfultz2</dc:creator><comments>https://news.ycombinator.com/item?id=14272027</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=14272027</guid></item><item><title><![CDATA[New comment by pfultz2 in "Build2 – A C++ Build Toolchain and Package Manager"]]></title><description><![CDATA[
<p>This sound similar to cmake-get:<p><a href="https://github.com/pfultz2/cmake-get" rel="nofollow">https://github.com/pfultz2/cmake-get</a></p>
]]></description><pubDate>Fri, 05 May 2017 08:43:44 +0000</pubDate><link>https://news.ycombinator.com/item?id=14271988</link><dc:creator>pfultz2</dc:creator><comments>https://news.ycombinator.com/item?id=14271988</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=14271988</guid></item><item><title><![CDATA[New comment by pfultz2 in "Build2 – A C++ Build Toolchain and Package Manager"]]></title><description><![CDATA[
<p>pkg-config works on windows with visual studio as well.</p>
]]></description><pubDate>Fri, 05 May 2017 08:42:42 +0000</pubDate><link>https://news.ycombinator.com/item?id=14271980</link><dc:creator>pfultz2</dc:creator><comments>https://news.ycombinator.com/item?id=14271980</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=14271980</guid></item></channel></rss>