[前][次][番号順一覧][スレッド一覧]

ruby-changes:70137

From: Jemma <ko1@a...>
Date: Fri, 10 Dec 2021 01:24:10 +0900 (JST)
Subject: [ruby-changes:70137] b859397e1b (master): [DOC] Stop recommending Qfalse==0 assumption to C extensions

https://git.ruby-lang.org/ruby.git/commit/?id=b859397e1b

From b859397e1b25a3f7847a380e7dd7db62f94fbe66 Mon Sep 17 00:00:00 2001
From: Jemma Issroff <jemmaissroff@g...>
Date: Thu, 9 Dec 2021 11:23:51 -0500
Subject: [DOC] Stop recommending Qfalse==0 assumption to C extensions

Encourage use of RTEST(), direct Qfalse comparison, and remove references to
Qfalse == 0 in extension documentation.

See [Bug #18397] for detail.
[ci skip]
---
 doc/extension.rdoc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/doc/extension.rdoc b/doc/extension.rdoc
index 1054e6a6afa..15417179e19 100644
--- a/doc/extension.rdoc
+++ b/doc/extension.rdoc
@@ -93,7 +93,9 @@ There are also faster check macros for fixnums and nil. https://github.com/ruby/ruby/blob/trunk/doc/extension.rdoc#L93
 The data for type T_NIL, T_FALSE, T_TRUE are nil, false, true
 respectively.  They are singletons for the data type.
 The equivalent C constants are: Qnil, Qfalse, Qtrue.
-Note that Qfalse is false in C also (i.e. 0), but not Qnil.
+RTEST() will return true if a VALUE is neither Qfalse nor Qnil.
+If you need to differentiate Qfalse from Qnil,
+specifically test against Qfalse.
 
 The T_FIXNUM data is a 31bit or 63bit length fixed integer.
 This size depends on the size of long: if long is 32bit then
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]