[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: libssh and Visual C++ (again)


On Sunday 30 September 2012 17:18:32 Aris Adamantiadis wrote:
> > Replacing ssize_t by int32_t is an ABI breakage under 64 bits platforms
> > Replacing ssize_t by int64_t is an ABI breakage under 32 bits platforms
> > 
> > The definition of ssize_t is : the same bit count as size_t, but signed.
> > 
> > Christophe
> 
> Hi,
> 
> I did not follow the whole thread, but based on your description, why not:
> #if (sizeof(size_t)==4)
> typedef u_int32_t ssh_ssize_t
> #else
> typedef u_int64_t ssh_ssize_t
> #endif
> 
> I also wonder if ssize_t is the appropriate type for the return of such
> functions. The libc use int for read(2) for a reason.
> When did we introduce them in libssh ? if it's a recent patch we could
> simply go back to an int.

The cound is what ssh_string_len() returns. This is a 32bit unsigned int. So 
we need a type which can hold the value and also -1 for the error return code. 
So and int64_t would be the correct return type here.

As ssize_t is always int64 on unix cause we build with lfs support. It should 
not really be an ABI breakage.


	-- andreas

-- 
Andreas Schneider                   GPG-ID: F33E3FC6
www.cryptomilk.org                asn@xxxxxxxxxxxxxx


References:
libssh and Visual C++ (again)Christophe Baribaud <christophe.baribaud@xxxxxxxxx>
Re: libssh and Visual C++ (again)Christophe Baribaud <christophe.baribaud@xxxxxxxxx>
Re: libssh and Visual C++ (again)Aris Adamantiadis <aris@xxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org