<div dir="ltr">Hi Reid,<div><br></div><div>I was going to pick your brain on this in person but it seems you're not over in London for the conference. Anyhow, I've tried a few variations but I've been unable to find a way to better handle this edge case without doing some heavy refactoring.</div><div><br></div><div>Do you have fundamental objections to the approach taken (and I admit it's not pretty) or is it simply that the comment leaves something to be desired - such as a clearer comment?</div><div><br></div><div>- Will.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 11 April 2015 at 01:06, Will Wilson <span dir="ltr"><<a href="mailto:will@indefiant.com" target="_blank">will@indefiant.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra">Hi Reid,</div><span class=""><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><div><div class="gmail_extra"></div></div></div></blockquote></div><br>
</div></span><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><span class="HOEnZb"><font color="#888888"><div><br></div><div>- Will.</div></font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><span style="background-color:rgb(255,255,255);color:rgb(68,68,68);font-family:Arial,Helvetica,sans-serif"><b>Indefiant </b>: <a href="http://www.indefiant.com" target="_blank">http://www.indefiant.com</a></span></div><div><span style="font-family:Arial,Helvetica,sans-serif"><font color="#999999">Home of Recode : Runtime C++ Editing for VS</font></span></div></div></div>
</div>