Rb_time_new() change in 1.8.2?

Hi all,

Contrary to http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/2725,
rb_time_new() will accept a single argument in 1.8.1 and assume 0 as
the second argument.

However, testing with 1.8.2 RC2 reveals that the second argument is
now mandatory. Is this intentional? Why not simply keep the current
behavior, and assume 0 as the second argument if none is provided?

Regards,

Dan

Hi,

···

In message "rb_time_new() change in 1.8.2?" on 04/07/03, Daniel Berger <djberg96@hotmail.com> writes:

Contrary to http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/2725,
rb_time_new() will accept a single argument in 1.8.1 and assume 0 as
the second argument.

??

rb_time_new() has been taken 2 arguments all the time.

              matz.

Daniel Berger wrote:

Hi all,

Contrary to http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/2725,
rb_time_new() will accept a single argument in 1.8.1 and assume 0 as
the second argument.

It isn't contrary. In the same thread, Nobu explained why the
prototype _was_ defined without arguments. Consequently, your
compiler is informed that the number of args is unspecified.
As Matz has said, the function has always taken two args. If you
only provided one, the second would be read from next slot on the
CPU stack (whatever happened to be there at that moment).

However, testing with 1.8.2 RC2 reveals that the second argument is
now mandatory. Is this intentional?

Because the updated prototype allows your compiler to flag the error.

daz