ruby-dev summary 24354-24486

T

Takaaki Tateishi

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.
 
R

Robo

Takaaki said:
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
 
Y

Yukihiro Matsumoto

Hi,

In message "Re: ruby-dev summary 24354-24486"

|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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top