Donate Share

better string library

The forum address has changed, you have been automatically redirected. Please update any bookmarks to use the new URL.

Subscribe

int versus ssize_t usage

You are viewing a single message from this topic. View all messages.

  1. 2009-04-24 16:23:00 UTC
    Ooops! Missed this message somehow.

    Anyhow, ssize_t is not a standard defined type. I.e., its not defined for Microsoft, Watcom or Borland C or C++ as far as I know. I wanted to use a type for ->slen which would not increase the number of compiler warnings from truncations and which was signed. Furthermore, its rare to need a string > 32767 in length, so it seemed like an acceptable decision.

    If you truly have strings > (1<<31)-1 in length, then your concern is not fast indexed access to each character (which is really what bstrlib gives you) but rather with how you abstract the storage of such strings. In which case, I think a bsStream is usually a better abstraction.

    If you can truly make the case, perhaps I can change the size to something like blengthscalar_t which would be typedefed at the beginning of bstrlib.h and could be set to ssize_t or int or any other large enough signed scalar.

    Paul
< Previous | 1 | Next >

Add a Reply

This forum does not allow anonymous participation.

Log in to add a reply. Not registered? Create an account to participate and receive email updates when replies are posted to this topic.