GithubHelp home page GithubHelp logo

Comments (14)

JonathanDCohen avatar JonathanDCohen commented on May 18, 2024 1

Sorry for the silence on this. I'm slightly wary about this because a couple reasons

First, some of the people working on migrating google3 to c++17 have expressed some slight misgivings about it. Second, because, even though we don't really support it, this is potentially a break for use of abseil functions with ADL for a change which is, ideally otherwise invisible to the user and adds a corner case to the story of Abseil's handling of c++ versions. I agree with your sentiment that this is more an extension than some kind of non-conforming break, but seeing that string_view is a fairly simple type, I'm not sure the small risk is worth the payoff for this. But I'm definitely open to being convinced.

from abseil-cpp.

atkawa7 avatar atkawa7 commented on May 18, 2024

@mclow @derekmauro @rogeeff Should be careful about __has_include
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79433
https://bugs.chromium.org/p/chromium/issues/detail?id=759349&desc=2

from abseil-cpp.

zhangxy988 avatar zhangxy988 commented on May 18, 2024

@atkawa7 IIRC, the bug is about using libstdc++ with -std=<version older than c++17>. Since we are also checking __cplusplus >= 201703L, the bug should NOT be a concern.

from abseil-cpp.

atkawa7 avatar atkawa7 commented on May 18, 2024

@zhangxy988 See google/crc32c@d0f929a

from abseil-cpp.

zhangxy988 avatar zhangxy988 commented on May 18, 2024

@atkawa7 The commit seems strange to me: the bug in the original code is in #if !defined(_MSC_VER) || __cplusplus >= 201703L which is ignoring the __cplusplus >= 201703L check on any non MSVC compiler (GCC, Clang), and this should be fixed as #if !defined(_MSC_VER) && __cpluscplus >= 201703L (or simply #if __cplusplus >= 201703L since _MSC_VER set __cpluscplus to 199711).
So, I don't think this has anything to do with the GCC bug.

from abseil-cpp.

atkawa7 avatar atkawa7 commented on May 18, 2024

@zhangxy988 They are two different bugs but similar. So should be careful

from abseil-cpp.

JonathanDCohen avatar JonathanDCohen commented on May 18, 2024

This is really about libc++, yes? So really we just want to check for libc++, and handle the msvc and libstdc++ cases separately.

According to this stackoverflow we can do this by something like

#include <ciso646>
// ...
#ifdef _LIBCPP_VERSION
#define ABSL_HAVE_STD_STRING_VIEW 1
#else 
// ...

@mclow is this a reasonable idea?

from abseil-cpp.

mclow avatar mclow commented on May 18, 2024

Almost - you still have to check for the existence of the <string_view> header. Old versions of libc++ didn't have this. but if the header is there, then you have string_view

from abseil-cpp.

EricWF avatar EricWF commented on May 18, 2024

@mclow @JonathanDCohen Alternatively (if you don't have __has_include, but you should), you could probably check that _LIBCPP_VERSION >= 4000.

from abseil-cpp.

mclow avatar mclow commented on May 18, 2024

Maybe if you don't have __has_include maybe you should just fail (and say "no std::string_view)

from abseil-cpp.

JonathanDCohen avatar JonathanDCohen commented on May 18, 2024

Sorry for the silence here. I've had this sitting around internally for a bit, and there's some concern that libc++ backporting string_view is technically non-conforming, and could be surprising w.r.t. ADL. We also have to take a look at our FDO profiles before landing this as this would potentially change the mangled symbol names for anything taking a string_view

from abseil-cpp.

mclow avatar mclow commented on May 18, 2024

I think that "non-conforming" is a bit harsh. It's an extension, like marking the default constructor of vector as noexcept.

from abseil-cpp.

JonathanDCohen avatar JonathanDCohen commented on May 18, 2024

After some more discussions on this, I'm going to close this issue. It's tempting but there are other internal migration factors which this seems to complicate, and the payoff for it is fairly low. Thank you for the idea, though :) Please feel free to re-open if you feel this is a poor decision.

from abseil-cpp.

mclow avatar mclow commented on May 18, 2024

but there are other internal migration factors which this seems to complicate, and the payoff for it is fairly low.

Those are pretty hard for me to comment on (not being internal).

Please feel free to re-open if you feel this is a poor decision.

I'm not going to contest.

from abseil-cpp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.