This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Raw string support


On Thu, 16 Apr 2009, Joseph S. Myers wrote:

> give an error in this case.  This could require arbitrarily long 
> backtracking in lexing in some cases; consider:
> 
> R"foo["
> rest of a source file not containing ']foo"'
> 
> where because the end of a raw string cannot be found, the longest 
> sequence forming a preprocessing token is just the letter R.  It's 
> possible the specification is defective in some way and should not require 
> all this backtracking (whether or not any standard change extends to 
> making R" " an invalid raw string rather than two preprocessing tokens).

Incidentally, if WG21 and WG14 decide they want the unlimited 
backtracking, we'll need to decide whether to make the lexing smarter to 
avoid O(n^2) time being taken to lex

#define R
const char *s =
R"["
R"["
R"["
[repeat n times for large n]
;

or whether the performance of this corner case doesn't matter.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]