Re: [PATCH 1/2] MSVC: vsnprintf in Visual Studio 2015 doesn't need SNPRINTF_SIZE_CORR any more
- From
Sebastian Schuberth <sschuberth@gmail.com>
- Date
- Mar 30, 2016, 07:57 UTC
- Message-ID
- <CAHGBnuOu9BMfDjmozMHSGKCaA5sYYHYmPupL2-51has4rv-MqA@mail.gmail.com>
- In-Reply-To
- <alpine.DEB.2.20.1603300946410.4690@virtualbox>
On Wed, Mar 30, 2016 at 9:49 AM, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
Show 26 quoted lines
>> > #ifndef SNPRINTF_SIZE_CORR >> > -#if defined(WIN32) && (!defined(__GNUC__) || __GNUC__ < 4) >> > +#if defined(WIN32) && (!defined(__GNUC__) || __GNUC__ < 4) && (!defined(_MSC_VER) || _MSC_VER < 1900) >> > #define SNPRINTF_SIZE_CORR 1 >> > #else >> > #define SNPRINTF_SIZE_CORR 0 >> >> I wonder if the logic is (and was) sensible here. We assume that every >> non-__GNUC__ and non-_MSC_VER compiler on Windows requires the >> correction. Wouldn't it make sense to not assume requiring the >> correction unless we know the compiler has this bug? That is, >> shouldn't this better say >> >> #if defined(WIN32) && (defined(__GNUC__) && __GNUC__ < 4) || >> (defined(_MSC_VER) && _MSC_VER < 1900)) >> #define SNPRINTF_SIZE_CORR 1 >> #else >> #define SNPRINTF_SIZE_CORR 0 > > Since the standard on Windows always was MS Visual C, it should be assumed > that compilers *other* than GCC followed Visual C's lead. > > Of course, evidence speaks louder than assumptions. > > Therefore I would prefer to keep the current version, at least until we > encounter a case where it is incorrect.
Fine with me. It's probably better not to change the logic as we wouldn't know whether this would break things for some exotic compiler currently in use to compile Git.
Also ACK from my side on the path then.
-- Sebastian Schuberth