[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]
This commit is contained in:
Jemma Issroff 2021-12-09 11:23:51 -05:00 committed by GitHub
parent bcc2bb28b0
commit b859397e1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
Notes: git 2021-12-10 01:24:17 +09:00
Merged: https://github.com/ruby/ruby/pull/5230

Merged-By: XrXr

View File

@ -93,7 +93,9 @@ There are also faster check macros for fixnums and nil.
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