is (size_t)-1 garanteed to be greater then (size_t)0? Then it's ok otherwise it's butt ugly imo.
On 10/8/09, Constantine Verutin <[email protected]> wrote: > Hi, > > On Thu, Oct 8, 2009 at 12:54 AM, Victor Goya <[email protected]> wrote: > I guess it's because size_t is usually an unsigned int, thus > >> ((size_t)-1) == 2^32-1. >> Some users may want to use the maximum size available that doesn't exceed >> the size they can handle with size_t and write something like : >> evhttp_set_max_body_size(http, UINT32_MAX); >> >> This may lead to an unexpected behavior. Perhaps you can define something >> like : >> EVHTTP_SIZE_MAX ((size_t)-2) >> > > Well, (size_t)-1 is a max value of size_t b/c it's unsigned integer type > according to C99 ( that's why it's reasonable for -1 to be some kind of > 'special' value of size_t). I still don't realize why it can lead to > unexpected behavior. > > -- > WBR, > Constantine > *********************************************************************** To unsubscribe, send an e-mail to [email protected] with unsubscribe libevent-users in the body.
