<div dir="ltr"><div class="gmail_extra">Hi Reid,</div><div class="gmail_extra"><br><div class="gmail_quote">On 11 April 2015 at 00:29, Reid Kleckner <span dir="ltr"><<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>I still think a local fix would be better. As a reader, it's hard to convince myself that the comment is correct:</div><div><div>+  // MSVC: If previous token was pasted, this must be a recovery from an invalid</div><div>+  // paste operation. Ignore spaces before this token to mimic MSVC output.</div><div>+  // Required for generating valid UUID strings in some MS headers.</div></div><div><br></div><div>Why is it that we only come here for invalid token pastes?</div></div><div class=""><div class="h5"><div class="gmail_extra"></div></div></div></blockquote></div><br>
</div><div class="gmail_extra">The doc for PasteTokens() gives the general premise of the function:</div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_extra"><br></div><div class="gmail_extra">Tok is the LHS of a ## operator, and CurToken is the ##</div></div><div class="gmail_extra"><div class="gmail_extra">operator.  Read the ## and RHS, and paste the LHS/RHS together.  If there</div></div><div class="gmail_extra"><div class="gmail_extra">are more ## after it, chomp them iteratively.</div><div class="gmail_extra"><br></div></div></blockquote>Basically, if an invalid paste is attempted, the iteration is aborted and the concatenated token is returned without doing any more pasting. Therefore, assuming a successful PasteTokens() call would have consumed all ## operators, the only reason PasteTokens() would be called with an earlier ## in the Tokens array would be if the iteration were previously aborted. At least, this is my understanding of it.<div><br></div><div>It's not pretty, but without rewriting the iteration logic to deal cleanly with the MSVC pasting logic I'm not sure how to improve it... Any ideas?</div><div><br></div><div>- Will.</div></div>