Feature #7518

Fiddle::Pointer#to_str and Fiddle::Pointer#to_int should be removed

Added by Naohisa Goto over 1 year ago. Updated 8 months ago.

[ruby-core:50578]
Status:Assigned
Priority:Normal
Assignee:Aaron Patterson
Category:ext
Target version:-

Description

There are Fiddle::Pointer#tostr and toint, to be used for implicit conversion to String and Integer, respectively. I think those implicit conversion methods should be removed.
(Note that there are tos and toi, explicit conversion to String and Integer, respectively.)

About to_str: Because Fiddle::Pointer is not always a pointer of char *, and careless conversion of invalid pointer to a string would frequently cause SEGV. So, I think implicit conversion to string is very danger and it should be removed.

About toint: Unlike tostr, pointer arithmetic methods are available in Fiddle::Pointer, but it lacks many methods for treating it as integer, and I think Fiddle::Pointer is not suitable for implicit conversion to integer.

History

#1 Updated by Luis Lavena over 1 year ago

  • Category set to ext
  • Status changed from Open to Assigned

#2 Updated by Zachary Scott 8 months ago

Perhaps they are there for DL compat?

Also available in: Atom PDF