Forum: Ruby-Gnome 2 RVAL2CBOOL lax type check

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C838db9af1d90a87a828ecad8556b804?d=identicon&s=25 Guillaume Cottenceau (Guest)
on 2007-07-13 18:25
(Received via mailing list)
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 Cottenceau - 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/
C838db9af1d90a87a828ecad8556b804?d=identicon&s=25 Guillaume Cottenceau (Guest)
on 2007-07-13 18:26
(Received via mailing list)
> 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 Cottenceau - 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/
9fe908f5593444a40be14a424c372e58?d=identicon&s=25 Masao Mutoh (Guest)
on 2007-07-13 19:19
(Received via mailing list)
Hi,

On Fri, 13 Jul 2007 18:23:49 +0200
"Guillaume Cottenceau" <gcottenc@gmail.com> 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 Mutoh<mutoh@highway.ne.jp>


-------------------------------------------------------------------------
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/
This topic is locked and can not be replied to.