cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl internal bool TRUE and FALSE definitions and usage

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sun, 16 Dec 2012 11:10:37 +0100 (CET)

On Sun, 16 Dec 2012, Yang Tse wrote:

> The purpose of internally using the bool data type was to detect and avoid
> unclever assignments to bool variables, attempting to get compiler warnings
> or errors when such a condition existed.

While a good intention, I think it is time to reevaluate if this is really
doable nicely in the long run.

> Modify libcurl to use 'private' namespace. Use 'curl_bool' instead of
> 'bool', CURL_TRUE instead of TRUE, CURL_FALSE instead of FALSE.
>
> 'curl_bool' could be our own enum definition only for systems which lack
> 'bool' or for all.

I like using the traditional 'bool' name for the simple reason that it is
familiar and what people will use and understand. Also because it prevents
someone one from _wrongly_ introducing bool in a patch down the road when we
miss that the contributor doesn't use curl_bool...

I think we can go back to have TRUE and FALSE just be 1 and 0 for systems
without a bool of their own.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2012-12-16