apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henry Jen <henry...@ztune.net>
Subject Re: Thread pool prototype
Date Wed, 03 May 2006 16:47:25 GMT
Joe Orton wrote:
> On Wed, May 03, 2006 at 09:41:14AM -0400, Greg Marr wrote:
>> At 05:32 AM 5/3/2006, Joe Orton wrote:
>>>> +    me->cnt_max = max_threads;
>>>> +    me->idle_max = init_threads;
>>>> +    rv = apr_thread_mutex_create(&me->lock, 
>>> APR_THREAD_MUTEX_NESTED,
>>>> +                                 me->pool);
>>>> +    if (APR_SUCCESS != rv) {
>>> Personally I find the "constant != variable" style very distracting, 
>>> not sure if this is a widely held view...
>> FYI, I use it almost exclusively, because if you mean to type
>>
>> if (APR_SUCCESS == rv)
>>
>> and instead you type
>>
>> if (APR_SUCCESS = rv)
>>
>> the compiler will catch it for you.  If you normally do variable == 
>> constant instead, you have no such protection.
> 
> GCC has issued a warning for "if (foo = 2)" forever, if you aren't 
> running your code through gcc -Wall regularly you have more serious 
> problems anyway, certainly that's not worth sacrificing readability for 
> IMO.
> 

An error works better than a warning, IMHO :-)

Cheers,
Henry

Mime
View raw message