Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

So, someone at some point in some commit that we will never see because it got squashed with other commits thought it would be cooler to use absl::StrCat() instead of the "+" operator, and in the process of doing that, they went "what's this useless code using angled brackets instead of quotes?! It works with quotes too, let's delete it!". Or maybe that part was difficult to test, so they simply deleted it to increase test coverage? Guess we will never know, but still, open source is now a bit shittier because of it. Thanks, anonymous clueless developer!

    --  std::string left = "\"";
    --  std::string right = "\"";
    --  if (use_system_include) {
    --    left = "<";
    --    right = ">";
    --  }
    --  return left + name + right;
    ++  return absl::StrCat("\"", basename, "\"");


In the chromium repository, the use of angle brackets in #include statements is banned -- they only use double quotes. They also don't use any system headers per se since their flavor of clang comes with their flavor of libcpp vendored in.

So if the chromium repo is representative of the state of C++ in rest of Google, they ditched it silently like this probably because it's so natural to them :)


So, instead of using

> <> means system headers and "" means project headers (my naive understanding of the difference)

they just convert everything to a project header? That seems bonkers to me. It is intentionally removing useful information.


First, here's the actual guide: https://google.github.io/styleguide/cppguide.html#Names_and_... . Of course they still have to use stuff like #include <windows.h> but it's very very limited.

They also are not removing any info -- most of it IS project headers. To me that's the actual bonkers bit :)

With GCC/Clang, headers found in paths passed with -isystem are headers that are immune to compiler arguments like -Werror because they are, by definition, out of your control. In Google's case, ALL code is already checked in the project repo, including language stdlib. So none of them are system headers "per se".


The main difference is how the search for the file works. “” prefers local directory before the search path, <> goes to the search path first.


Hierarchy is problematic.


Why do you think it was squashed? This article is clear about this being a merge commit. This person got a merge conflict and decided that this was the best way to fix it. It probably worked on their machine. Perhaps not necessarily the optimal fix when you have thousands of users depending on this code, but what do I know?


But according to the article, both of the parents contained the same old code. Could be that it was just collateral damage in a larger conflict, but still it seems that someone used the merge commit to make an off-topic, ad-hoc change that was not only superfluous but code-breaking.


Ok, maybe I'm misunderstanding the line "There's no explanation or other context. Presumably that all got squashed out when it was exported from whatever they use internally." - I was thinking about git squash, but it could have also been some other step in the process of transferring the code from Google's internal systems to GitHub.


It's such a spectacular Chesterton's Fence. Always so frustrating dealing with people who're like "from where I'm standing…" and then they go and make things better, meaning 'more abstract and/or fewer keystrokes'.


Am I misunderstand or is this not on whoever abused the merge commit, whether they made the change personally or not.


It's a shared responsibility.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: