From mich@elchirico4 @ending from gm@il@com  Fri Jan 11 07:36:17 2019
From: mich@elchirico4 @ending from gm@il@com (Michael Chirico)
Date: Fri, 11 Jan 2019 14:36:17 +0800
Subject: [Rd] strtoi output of empty string inconsistent across platforms
Message-ID: <CAPRVBczEB89pKT6Wk_mYw9mzQfWkyE033Y_haR50QftP5v1Tdw@mail.gmail.com>

Identified as root cause of a bug in data.table:

https://github.com/Rdatatable/data.table/issues/3267

On my machine, strtoi("", base = 2L) produces NA_integer_ (which seems
consistent with ?strtoi: "Values which cannot be interpreted as integers or
would overflow are returned as NA_integer_").

But on all the other machines I've seen, 0L is returned. This seems to be
consistent with the output of a simple C program using the underlying
strtol function (see data.table link for this program, and for full
sessionInfo() of some environments with differing output).

So, what is the correct output of strtoi("", base = 2L)? Is the
cross-platform inconsistency to be expected/documentable?

Michael Chirico

	[[alternative HTML version deleted]]



[Rd] strtoi output of empty string inconsistent across platforms
Michael Chirico