Forum: Ruby-core [ruby-trunk - Feature #7518][Open] Fiddle::Pointer#to_str and Fiddle::Pointer#to_int should be remov

Posted by ngoto (Naohisa Goto) (Guest)
on 2012-12-05 15:39
(Received via mailing list)
Issue #7518 has been reported by ngoto (Naohisa Goto).

----------------------------------------
Feature #7518: Fiddle::Pointer#to_str and Fiddle::Pointer#to_int should 
be removed
https://bugs.ruby-lang.org/issues/7518

Author: ngoto (Naohisa Goto)
Status: Open
Priority: Normal
Assignee: tenderlovemaking (Aaron Patterson)
Category:
Target version:


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.
Posted by Luis Lavena (luislavena)
on 2012-12-05 17:01
(Received via mailing list)
Issue #7518 has been updated by luislavena (Luis Lavena).

Category set to ext
Status changed from Open to Assigned


----------------------------------------
Feature #7518: Fiddle::Pointer#to_str and Fiddle::Pointer#to_int should 
be removed
https://bugs.ruby-lang.org/issues/7518#change-34423

Author: ngoto (Naohisa Goto)
Status: Assigned
Priority: Normal
Assignee: tenderlovemaking (Aaron Patterson)
Category: ext
Target version:


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.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.