RVAL2CBOOL lax type check

So we now use RVAL2CBOOL for rg2 library calls awaiting a gboolean
parameter. Though, RVAL2CBOOL is RTEST and RTEST is kinda lax: it
accepts barely any ruby value. So basically you can pass nil, a
string, or a widget and these will all be false (except nil of
course).

What if we added a check in the RVAL2CBOOL macro, to rb_warn on
anything else than Qtrue and Qfalse?


Guillaume C. - http://zarb.org/~gc/


This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

string, or a widget and these will all be false (except nil of

… will all be true

(week-end is here for taking some rest)


Guillaume C. - Guillaume Cottenceau


This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

Hi,

On Fri, 13 Jul 2007 18:23:49 +0200
“Guillaume C.” [email protected] wrote:

So we now use RVAL2CBOOL for rg2 library calls awaiting a gboolean
parameter. Though, RVAL2CBOOL is RTEST and RTEST is kinda lax: it
accepts barely any ruby value. So basically you can pass nil, a
string, or a widget and these will all be false (except nil of
course).

What if we added a check in the RVAL2CBOOL macro, to rb_warn on
anything else than Qtrue and Qfalse?

No,no. The values except false/nil becomes true in Ruby.
It’s a correct behaviour. So we don’t need to warn such things.


.:% Masao M.[email protected]


This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/