On Wed, Oct 7, 2009 at 11:30 PM, Constantine Verutin <[email protected]> wrote: > Hi, > > On Wed, Oct 7, 2009 at 10:16 PM, q6Yr7e0o nIJDVMjC <[email protected]> > wrote: >> >> I like the idea but defining SIZE_UNLIMITED as -1 and comparing a >> size_t to it doesn't seem right somehow. Wouldn't it be better do >> define SIZE_UNLIMITED to 0 which is a valid size_t value and does not >> make sense for the limits so it can be used as magic number? > > I see no reason why it can't be -1 (well, the best way here is to define > SIZE_UNLIMITED as ((size_t) -1) ). Btw, setting the 'unlimited' constant to > 0 is definitely wrong solution. > > -- > WBR, > Constantine >
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) However, your work is really useful, thank you :) -- Victor Goya *********************************************************************** To unsubscribe, send an e-mail to [email protected] with unsubscribe libevent-users in the body.
