tfpt review /shelveset:RubyArrayPack;REDMOND\curth Significant subset of Array.pack and String.unpack -- Curt Hagenlocher curth at microsoft.com -------------- next part -------------- A non-text attachment was scrubbed... Name: RubyArrayPack.diff Type: application/octet-stream Size: 36190 bytes Desc: RubyArrayPack.diff URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20080521/ef90e901/attachment-0001.obj>
What is MRI behavior if I return a number that doesn''t fit in sbyte? writer.Write((sbyte)Protocols.CastToFixnum(context, self[i + j])); Does it silently overflow? If so, we should use unchecked() region. Other than that looks good. Tomas -----Original Message----- From: Curt Hagenlocher Sent: Wednesday, May 21, 2008 3:15 PM To: IronRuby External Code Reviewers Cc: ironruby-core at rubyforge.org Subject: Code Review: RubyArrayPack tfpt review /shelveset:RubyArrayPack;REDMOND\curth Significant subset of Array.pack and String.unpack -- Curt Hagenlocher curth at microsoft.com
Is the "unchecked" just a formality under C#? It''s not currently throwing an exception. IronRuby:>>> [1000].pack(''c'')=> "\350" Matz: irb(main):012:0> [1000].pack(''c'') => "\350" -----Original Message----- From: Tomas Matousek Sent: Wednesday, May 21, 2008 3:24 PM To: Curt Hagenlocher; IronRuby External Code Reviewers Cc: ironruby-core at rubyforge.org Subject: RE: Code Review: RubyArrayPack What is MRI behavior if I return a number that doesn''t fit in sbyte? writer.Write((sbyte)Protocols.CastToFixnum(context, self[i + j])); Does it silently overflow? If so, we should use unchecked() region. Other than that looks good. Tomas -----Original Message----- From: Curt Hagenlocher Sent: Wednesday, May 21, 2008 3:15 PM To: IronRuby External Code Reviewers Cc: ironruby-core at rubyforge.org Subject: Code Review: RubyArrayPack tfpt review /shelveset:RubyArrayPack;REDMOND\curth Significant subset of Array.pack and String.unpack -- Curt Hagenlocher curth at microsoft.com
More or less. But you can also compile with /checked option and then it wouldn''t work. It''s better to mark places where you expect the overflow, because you usually don''t expect it. Tomas -----Original Message----- From: Curt Hagenlocher Sent: Wednesday, May 21, 2008 3:28 PM To: Tomas Matousek; IronRuby External Code Reviewers Cc: ironruby-core at rubyforge.org Subject: RE: Code Review: RubyArrayPack Is the "unchecked" just a formality under C#? It''s not currently throwing an exception. IronRuby:>>> [1000].pack(''c'')=> "\350" Matz: irb(main):012:0> [1000].pack(''c'') => "\350" -----Original Message----- From: Tomas Matousek Sent: Wednesday, May 21, 2008 3:24 PM To: Curt Hagenlocher; IronRuby External Code Reviewers Cc: ironruby-core at rubyforge.org Subject: RE: Code Review: RubyArrayPack What is MRI behavior if I return a number that doesn''t fit in sbyte? writer.Write((sbyte)Protocols.CastToFixnum(context, self[i + j])); Does it silently overflow? If so, we should use unchecked() region. Other than that looks good. Tomas -----Original Message----- From: Curt Hagenlocher Sent: Wednesday, May 21, 2008 3:15 PM To: IronRuby External Code Reviewers Cc: ironruby-core at rubyforge.org Subject: Code Review: RubyArrayPack tfpt review /shelveset:RubyArrayPack;REDMOND\curth Significant subset of Array.pack and String.unpack -- Curt Hagenlocher curth at microsoft.com