Skip to content

Commit 42c0722

Browse files
committed
[DOC] Fix the comment for RUBY_CONST_ID and rb_intern
RUBY_CONST_ID has never been deprecated; `rb_intern` is handy but it is using non-standard GCC extensions and does not cache the ID with other compilers.
1 parent 3294d3d commit 42c0722

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

include/ruby/internal/symbol.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,9 @@ rbimpl_intern_const(ID *ptr, const char *str)
316316
}
317317

318318
/**
319-
* Old implementation detail of rb_intern().
320-
* @deprecated Does anyone use it? Preserved for backward compat.
319+
* Returns the cached ID for the given str in var, in compiler
320+
* independent manner. Use this instead of GCC specific rb_intern()
321+
* when you want to cache the ID on all platforms certainly.
321322
*/
322323
#define RUBY_CONST_ID(var, str) \
323324
do { \
@@ -326,7 +327,8 @@ rbimpl_intern_const(ID *ptr, const char *str)
326327
} while (0)
327328

328329
#if defined(HAVE_STMT_AND_DECL_IN_EXPR)
329-
/* __builtin_constant_p and statement expression is available
330+
/* GCC specific shorthand for RUBY_CONST_ID().
331+
* __builtin_constant_p and statement expression is available
330332
* since gcc-2.7.2.3 at least. */
331333
#define rb_intern(str) \
332334
(RBIMPL_CONSTANT_P(str) ? \

0 commit comments

Comments
 (0)