<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Jul 22, 2014 at 6:46 AM, <a href="mailto:thaddy@thaddy.com">thaddy@thaddy.com</a> <span dir="ltr"><<a href="mailto:thaddy@thaddy.com" target="_blank">thaddy@thaddy.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">A case for ternary computing is not really a bad idea ;)<br>
<br>
On 21-7-2014 21:42, Hans-Peter Diettrich wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Dmitry Boyarintsev schrieb:<div class=""><br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
How about introducing a default parameter?<br>
The parameter keeps the method backward compatible, allowing write a string without the prefix.<br>
<br>
public procedure TStream.WriteAnsiString(<br>
  const S: string;<br>
  withLength: Boolean = true;<br>
</blockquote>
<br></div>
How should a string without a length be read back?<br>
<br>
DoDi<div class=""><br></div></blockquote></blockquote></div>I didn't see DoDi's email anywhere in the thread, though it seems like there're two threads anyway:<br>"Re: [fpc-devel] Method for write string into TStream" and "[fpc-devel] Method for write string into TStream"<br>
</div><div class="gmail_extra"><br></div><div class="gmail_extra">Anyways, answering DoDi's question.<br></div><div class="gmail_extra">It definitely won't be able to read a string without a size, but it doesn't mean that the string size should immediately precede the string content. <br>
</div><div class="gmail_extra"></div><div class="gmail_extra">So maybe a modification like this could help<br><br>procedure TStream.ReadAnsiString(knownsize: Integer=-1)<br></div><div class="gmail_extra">   if knownsize<0 then <br>
</div><div class="gmail_extra">     TheSize := ...readsize <br></div><div class="gmail_extra">  else <br></div><div class="gmail_extra">     TheSize := knownsize<br></div><div class="gmail_extra"><br>thanks,<br>Dmitry<br>
</div></div>