This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch] Fix regex `nosubs` correctly
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: Tim Shen <timshen91 at gmail dot com>
- Cc: libstdc++ <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 21 Jan 2014 19:39:16 +0000
- Subject: Re: [Patch] Fix regex `nosubs` correctly
- Authentication-results: sourceware.org; auth=none
- References: <CAPrifD=s5czQ3pHGFLjybk1rK7Ebp3LboDtZ9nDoaXqScN_g2g at mail dot gmail dot com> <20140121100855 dot GB31912 at redhat dot com> <CAPrifD=QP2_XN=EDshBEp=s5SU_Hg4Lqdk0jWeP-vzB+ic=FnQ at mail dot gmail dot com>
On 21/01/14 14:14 -0500, Tim Shen wrote:
My conclusion is actually based on Boost.Regex's behavior.
boost::basic_regex::mark_count() returns 1 with nosubs flag. Note that
boost::basic_regex::mark_count() == std::basic_regex::mark_count() +
1, because std does not count the 0th capture (the whole regex) in.
libc++'s mark_count returns 0 as well.
OK, thanks for confirming that. In that case your patch is OK to
commit.
I'll raise a defect report against the standard as I don't think the
specification of nosubs is clear. If that's what it means then it
should be defined in terms of "marked sub-expressions" not just by
stating the effect it has on match_results objects.