[Lldb-commits] [PATCH] Implement snprintf for MSVC with correct return value.

Chaoren Lin chaorenl at google.com
Wed May 27 09:33:09 PDT 2015


>
> So as far as I can tell the value of `errno` is undefined in the case that
> `buffer`, `format`, and `count` are all valid, but `count` is just not big
> enough (which is really the case we're trying to handle anyway).


FWIW, I think it's not defined in the MSDN docs because it's already
defined in the C standard for all system/library calls.

On Wed, May 27, 2015 at 9:25 AM, Chaoren Lin <chaorenl at google.com> wrote:

> > So as far as I can tell the value of `errno` is undefined in the case
> that
>
> >  `buffer`, `format`, and `count` are all valid, but `count` is just not
> big
>
> >  enough (which is really the case we're trying to handle anyway).
>
>
> Yeah, errno should be 0 only in the case that count is not big enough,
> which is exactly what I'm checking for. (It's the caller's responsibility
> to clear errno before calling snprintf). Otherwise, there's an error, and
> it should be returned as is, and the fprintf wouldn't be necessary.
>
>
> http://reviews.llvm.org/D10048
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150527/18d89772/attachment.html>


More information about the lldb-commits mailing list