[Ironruby-core] Code Review: RubyArrayPack

Tomas Matousek Tomas.Matousek at microsoft.com
Wed May 21 18:45:29 EDT 2008


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


More information about the Ironruby-core mailing list