Project

General

Profile

Actions

Feature #7518

open

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

Added by ngoto (Naohisa Goto) almost 12 years ago. Updated over 11 years ago.

Status:
Assigned
Target version:
-
[ruby-core:50578]

Description

There are Fiddle::Pointer#to_str and to_int, to be used for implicit conversion to String and Integer, respectively. I think those implicit conversion methods should be removed.
(Note that there are to_s and to_i, 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 to_int: Unlike to_str, 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.

Actions

Also available in: Atom PDF

Like0
Like0Like0