Ok, makes sense.  Lgtm then<br><div class="gmail_quote"><div dir="ltr">On Wed, Jul 11, 2018 at 8:18 AM Owen Reynolds via Phabricator <<a href="mailto:reviews@reviews.llvm.org">reviews@reviews.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">gbreynoo added inline comments.<br>
<br>
<br>
================<br>
Comment at: lib/Support/raw_ostream.cpp:617-618<br>
+#ifdef _WIN64<br>
+  // Windows write() requires signed 32 bit input so SIZE_MAX can not be used <br>
+  size_t MaxWriteSize = _I32_MAX;<br>
+#else<br>
----------------<br>
zturner wrote:<br>
> Doesn't it actually require 32-bit unsigned input?<br>
> <br>
> <a href="https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/write" rel="noreferrer" target="_blank">https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/write</a><br>
> <br>
> ```<br>
> int _write(<br>
>    int fd,<br>
>    const void *buffer,<br>
>    unsigned int count<br>
> );<br>
> ```<br>
I'll clarify this in the comment above. <br>
Although the input type for _write is unsigned, the return type is signed ("-1" is returned in cases of an error). This is checked for in line 642. As the standard return of _write is to return how many bytes are written, in the case this value is larger than the signed max, the return value is a negative value. If the maximum unsigned value is written this will be -1 and indicate an error.<br>
<br>
As the comment below states, windows _write is following POSIX as the behaviour for a write greater than SSIZE_MAX is implementation defined. I think it's best to keep to the portable behaviour below and not write anything windows specific to allow for a larger than SSIZE_MAX write. <br>
<br>
<br>
Repository:<br>
  rL LLVM<br>
<br>
<a href="https://reviews.llvm.org/D48948" rel="noreferrer" target="_blank">https://reviews.llvm.org/D48948</a><br>
<br>
<br>
<br>
</blockquote></div>