[MacRuby] #1314: Objective-C methods with null-terminated arguments have a subtle issue

MacRuby ruby-noreply at macosforge.org
Fri Jun 3 17:31:20 PDT 2011


#1314: Objective-C methods with null-terminated arguments have a subtle issue
------------------------------------+---------------------------------------
 Reporter:  mrada@…                 |       Owner:  lsansonetti@…        
     Type:  defect                  |      Status:  new                  
 Priority:  critical                |   Milestone:                       
Component:  MacRuby                 |    Keywords:  reduction            
------------------------------------+---------------------------------------
 Because nil is a legitimate object in Ruby, but not in objective-c, it can
 introduce subtle bugs:

 Example:

 {{{

 framework 'Cocoa'
 array = NSArray.alloc.initWithObjects(nil,1,2,3)
 p array.size
 p array.inspect

 }}}

 Since reading the va_list stops when it finds the first nil, the array is
 never initialized with the numbers.

 I'm not sure how common this will be in practice though...

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/1314>
MacRuby <http://macruby.org/>



More information about the macruby-tickets mailing list