[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

ruby-dev summary 24354-24486

Takaaki Tateishi

10/16/2004 3:35:00 PM

Here is a summary of recent topics posted on ruby-dev.

ruby-dev:24354-24486

[ruby-dev:24396] Re: "a".sum(32) is 0

Akira Tanaka claimed that "a".sum(32) should not return zero,
since "a".sum(31) and "a".sum(33) return 97. This problem
is caused by a specification which describes that the behavior
of N<<(bit-width) is undefined. If you would like to check the
this behavior on your environment, try the following C code.

#include <stdio.h>
int main()
{
int n = 32;
printf("1<<n = %d\n", 1<<n);
printf("1<<32 = %d\n", 1<<32);
return 0;
}

[ruby-dev:24405] Auto stack growing on Mac OS X

Mitsuhiro Kondo posted a patch which realized an automatic
stack elongation, since the default stack size on Mac OS X
is less than that of Linux, and then posted another simple
patch which substitutes rlim_max for rlim_cur. However,
these two patch have not been merged yet because of further
investigation.

[ruby-dev:24444] ARGF.read(len) and EOF

Akira Tanaka claimed that ARGF.read should not wait for stdin,
since normal IO eventually returns nil which represents EOF.
So it is hard for him to use ARGF instead of IO. For example,
FileUtils.compare_stream works fine with IO, but it doesn't
work with ARGF to wait for stdin.
Minero Aoki suggested that the specification of ARGF be changed
so that we can read contents from either stdin or files listed
in ARGV. This issue is still under consideration.
--
Takaaki Tateishi <ttate@ttsky.net>




2 Answers

Robo

10/17/2004 2:32:00 AM

0

Takaaki Tateishi wrote:
> Here is a summary of recent topics posted on ruby-dev.
>
> ruby-dev:24354-24486
>
> [ruby-dev:24396] Re: "a".sum(32) is 0
>
> Akira Tanaka claimed that "a".sum(32) should not return zero,
> since "a".sum(31) and "a".sum(33) return 97.

Using WinXP Ruby 1.8.1, "a".sum(32) returns 97 for me?

irb(main):001:0> "a".sum(32)
=> 97

Robo

Yukihiro Matsumoto

10/17/2004 4:30:00 AM

0

Hi,

In message "Re: ruby-dev summary 24354-24486"
on Sun, 17 Oct 2004 11:34:26 +0900, Robo <robo@mars.com> writes:

|Using WinXP Ruby 1.8.1, "a".sum(32) returns 97 for me?
|
|irb(main):001:0> "a".sum(32)
|=> 97

It depends on compiler's undefined behavior.

matz.