Chun-ta pointed out that with C++-11, we also now have <regex>. i guess that would supersede any regex.h usage in C++ code.so how about:- for basic C code, use regex.h- for basic C++ code, <regex>- if you need more functionality, or speed is critical, use PCRE
On Thu, Oct 5, 2017 at 1:56 PM, Mike Frysinger <vap...@chromium.org> wrote:do we have any pref when it comes to using regex in C++ code ? i was thinking of updating our docs to suggest people start with the C lib's regex.h, and if that bare bones approach isn't sufficient, to use PCRE. looking at platform2, those look like the only things we use currently.-mike
--
--
Chromium OS Developers mailing list: chromiu...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-os-dev?hl=en
Chun-ta pointed out that with C++-11, we also now have <regex>. i guess that would supersede any regex.h usage in C++ code.so how about:- for basic C code, use regex.h- for basic C++ code, <regex>- if you need more functionality, or speed is critical, use PCREThat last point, I think, should favor Google's RE2.
On Thu, Oct 5, 2017 at 4:06 PM, Nam Nguyen <namn...@chromium.org> wrote:Chun-ta pointed out that with C++-11, we also now have <regex>. i guess that would supersede any regex.h usage in C++ code.so how about:- for basic C code, use regex.h- for basic C++ code, <regex>- if you need more functionality, or speed is critical, use PCREThat last point, I think, should favor Google's RE2.only reason i don't favor RE2 is that no one is using it in CrOS today whereas we have projects using PCRE. in general, the inertia seems to favor PCRE over RE2.-mike
On Thu, Oct 5, 2017 at 2:28 PM, Mike Frysinger <vap...@chromium.org> wrote:On Thu, Oct 5, 2017 at 4:06 PM, Nam Nguyen <namn...@chromium.org> wrote:Chun-ta pointed out that with C++-11, we also now have <regex>. i guess that would supersede any regex.h usage in C++ code.so how about:- for basic C code, use regex.h- for basic C++ code, <regex>- if you need more functionality, or speed is critical, use PCREThat last point, I think, should favor Google's RE2.only reason i don't favor RE2 is that no one is using it in CrOS today whereas we have projects using PCRE. in general, the inertia seems to favor PCRE over RE2.-mikeRE2 is used heavily within Chrome, and <regex> is banned by https://chromium-cpp.appspot.com/. The justification for the latter decision just seems to be the use of other similar libraries in Chrome, though, so I don't know how applicable it should be to Chrome OS.I do lean towards following Chrome's lead in the absence of strong reasons to the contrary. dev-libs/re2 looks like it's present in portage-stable, although I also don't see anyone using it.
On Fri, Oct 6, 2017 at 10:33 AM, Daniel Erat <de...@chromium.org> wrote:On Thu, Oct 5, 2017 at 2:28 PM, Mike Frysinger <vap...@chromium.org> wrote:On Thu, Oct 5, 2017 at 4:06 PM, Nam Nguyen <namn...@chromium.org> wrote:Chun-ta pointed out that with C++-11, we also now have <regex>. i guess that would supersede any regex.h usage in C++ code.so how about:- for basic C code, use regex.h- for basic C++ code, <regex>- if you need more functionality, or speed is critical, use PCREThat last point, I think, should favor Google's RE2.only reason i don't favor RE2 is that no one is using it in CrOS today whereas we have projects using PCRE. in general, the inertia seems to favor PCRE over RE2.-mikeRE2 is used heavily within Chrome, and <regex> is banned by https://chromium-cpp.appspot.com/. The justification for the latter decision just seems to be the use of other similar libraries in Chrome, though, so I don't know how applicable it should be to Chrome OS.I do lean towards following Chrome's lead in the absence of strong reasons to the contrary. dev-libs/re2 looks like it's present in portage-stable, although I also don't see anyone using it.My two cents: According to my personal experience, I'd recommend RE2 than <regex> in C++, ATM.In some cases (like a large regex), C++ standard <regex> (provided with clang) didn't work (i.e. crashed).I'm not sure how much we'd like to use regular expression in C/C++, though.In the code we manage (i.e. platform/ platform2/), we can migrate to use one regex lib technically, if necessary.Though, it doesn't help for third_party libs using pcre, so if we decide to use RE2, we may need to maintain two regex libs, at least?
On Fri, Oct 6, 2017 at 12:36 AM, Hidehiko Abe <hide...@chromium.org> wrote:
On Fri, Oct 6, 2017 at 10:33 AM, Daniel Erat <de...@chromium.org> wrote:
On Thu, Oct 5, 2017 at 2:28 PM, Mike Frysinger <vap...@chromium.org> wrote:On Thu, Oct 5, 2017 at 4:06 PM, Nam Nguyen <namn...@chromium.org> wrote:Chun-ta pointed out that with C++-11, we also now have <regex>. i guess that would supersede any regex.h usage in C++ code.so how about:- for basic C code, use regex.h- for basic C++ code, <regex>- if you need more functionality, or speed is critical, use PCREThat last point, I think, should favor Google's RE2.only reason i don't favor RE2 is that no one is using it in CrOS today whereas we have projects using PCRE. in general, the inertia seems to favor PCRE over RE2.
RE2 is used heavily within Chrome, and <regex> is banned by https://chromium-cpp.appspot.com/. The justification for the latter decision just seems to be the use of other similar libraries in Chrome, though, so I don't know how applicable it should be to Chrome OS.I do lean towards following Chrome's lead in the absence of strong reasons to the contrary. dev-libs/re2 looks like it's present in portage-stable, although I also don't see anyone using it.
My two cents: According to my personal experience, I'd recommend RE2 than <regex> in C++, ATM.In some cases (like a large regex), C++ standard <regex> (provided with clang) didn't work (i.e. crashed).I'm not sure how much we'd like to use regular expression in C/C++, though.In the code we manage (i.e. platform/ platform2/), we can migrate to use one regex lib technically, if necessary.Though, it doesn't help for third_party libs using pcre, so if we decide to use RE2, we may need to maintain two regex libs, at least?
I'd support using re2 both because of the stability guarantees (https://github.com/google/re2/wiki/WhyRE2) and to avoid diverging from Chrome's style for no reason.
On Fri, Oct 6, 2017 at 10:23 AM, Jorge Lucangeli Obes <jor...@chromium.org> wrote:On Fri, Oct 6, 2017 at 12:36 AM, Hidehiko Abe <hide...@chromium.org> wrote:On Fri, Oct 6, 2017 at 10:33 AM, Daniel Erat <de...@chromium.org> wrote:On Thu, Oct 5, 2017 at 2:28 PM, Mike Frysinger <vap...@chromium.org> wrote:On Thu, Oct 5, 2017 at 4:06 PM, Nam Nguyen <namn...@chromium.org> wrote:Chun-ta pointed out that with C++-11, we also now have <regex>. i guess that would supersede any regex.h usage in C++ code.so how about:- for basic C code, use regex.h- for basic C++ code, <regex>- if you need more functionality, or speed is critical, use PCREThat last point, I think, should favor Google's RE2.only reason i don't favor RE2 is that no one is using it in CrOS today whereas we have projects using PCRE. in general, the inertia seems to favor PCRE over RE2.RE2 is used heavily within Chrome, and <regex> is banned by https://chromium-cpp.appspot.com/. The justification for the latter decision just seems to be the use of other similar libraries in Chrome, though, so I don't know how applicable it should be to Chrome OS.I do lean towards following Chrome's lead in the absence of strong reasons to the contrary. dev-libs/re2 looks like it's present in portage-stable, although I also don't see anyone using it.My two cents: According to my personal experience, I'd recommend RE2 than <regex> in C++, ATM.In some cases (like a large regex), C++ standard <regex> (provided with clang) didn't work (i.e. crashed).I'm not sure how much we'd like to use regular expression in C/C++, though.In the code we manage (i.e. platform/ platform2/), we can migrate to use one regex lib technically, if necessary.Though, it doesn't help for third_party libs using pcre, so if we decide to use RE2, we may need to maintain two regex libs, at least?I'd support using re2 both because of the stability guarantees (https://github.com/google/re2/wiki/WhyRE2) and to avoid diverging from Chrome's style for no reason.i'm not anti-RE2, but to be clear, we'll still need to support PCRE because things like git, glib, wget, libselinux, and the wider open source community rely on it. not that we're authoring that code.