[PATCH] compat: provide a declaration of ssize_t, for MS windows

Maciej Fijalkowski fijall at gmail.com
Wed Jul 13 02:55:20 EDT 2016


can you guys commit the way you want it please? We've been
bikeshedding this simple change for like a week now. I have absolutely
zero opinion, I want to be able to use ssize_t. For all practical
purposes you can say typedef intptr_t ssize_t, but it does not work on
DOS16 or something like that

On Wed, Jul 13, 2016 at 1:19 AM, Sean Farley <sean at farley.io> wrote:
> Adrian Buehlmann <adrian at cadifra.com> writes:
>
>> On 2016-07-12 19:16, Maciej Fijalkowski wrote:
>>> # HG changeset patch
>>> # User Maciej Fijalkowski <fijall at gmail.com>
>>> # Date 1468238015 -7200
>>> #      Mon Jul 11 13:53:35 2016 +0200
>>> # Node ID 54968a2233db1823fa11f47dcc99395097bae3b4
>>> # Parent  b40939504d0e01e3a7f067b8cf49f26718a7c27c
>>> compat: provide a declaration of ssize_t, for MS windows
>>>
>>> diff -r b40939504d0e -r 54968a2233db mercurial/compat.h
>>> --- a/mercurial/compat.h     Mon Jul 11 11:05:08 2016 +0200
>>> +++ b/mercurial/compat.h     Mon Jul 11 13:53:35 2016 +0200
>>> @@ -5,6 +5,8 @@
>>>  #ifdef _MSC_VER
>>>  /* msvc 6.0 has problems */
>>>  #define inline __inline
>>> +#include <BaseTsd.h>
>>> +typedef SSIZE_T ssize_t;
>>>  typedef signed char int8_t;
>>>  typedef short int16_t;
>>>  typedef long int32_t;
>>
>> Perhaps, this can be simplified to:
>>
>> #if defined(_WIN64)
>>  typedef __int64 ssize_t;
>> #else
>>  typedef long ssize_t;
>> #endif
>>
>> (and thusly avoiding including BaseTsd.h ...)
>
> I like this suggestion.


More information about the Mercurial-devel mailing list