On Sun, 30 Sep 2012 17:18, [email protected] said: > 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.
size_t has been introduced as a type to represent in-memory objects in contrast to standard types which are commonly used for arithmetic. Both are subject to different system properties. "int" has several advantages and no drawbacks for libssh. Even on 64 bit systems you will never handle objects even close to 4GB. The ssh protocol has no way to describe such objects. Printing "int" is much easier than "size_t" because not all platforms support "%zu". A custom "foo_size_t" is worse because you have no way to print its values without casting to a guessed type. There is a reason the "z" format length modifier was introduced. Shalom-Salam, Werner -- Die Gedanken sind frei. Ausnahmen regelt ein Bundesgesetz.
