[#45341] 非同期割り込みに対する対処案(日本語版) — SASADA Koichi <ko1@...>

 ささだです.

28 messages 2012/03/11
[#45816] Re: 非同期割り込みに対する対処案(日本語版) — SASADA Koichi <ko1@...> 2012/06/25

 ささだです.

[#45817] Re: 非同期割り込みに対する対処案(日本語版) — Tanaka Akira <akr@...> 2012/06/25

2012年6月25日 18:26 SASADA Koichi <ko1@atdot.net>:

[#45819] Re: 非同期割り込みに対する対処案(日本語版) — SASADA Koichi <ko1@...> 2012/06/25

 ささだです.

[#45820] Re: 非同期割り込みに対する対処案(日本語版) — Tanaka Akira <akr@...> 2012/06/25

2012年6月25日 19:39 SASADA Koichi <ko1@atdot.net>:

[#45827] Re: 非同期割り込みに対する対処案(日本語版) — SASADA Koichi <ko1@...> 2012/06/25

(2012/06/25 20:32), Tanaka Akira wrote:

[#45841] Re: 非同期割り込みに対する対処案(日本語版) — Tanaka Akira <akr@...> 2012/06/25

2012年6月26日 3:40 SASADA Koichi <ko1@atdot.net>:

[#45372] Marshal.dumpにおけるインスタンス変数の取り扱いについて — keiju@... (Keiju ISHITSUKA)

けいじゅ@いしつかです.

14 messages 2012/03/16
[#45376] Re: Marshal.dumpにおけるインスタンス変数の取り扱いについて — Yukihiro Matsumoto <matz@...> 2012/03/17

まつもと ゆきひろです

[#45377] Re: Marshal.dumpにおけるインスタンス変数の取り扱いについて — keiju@... (石塚圭樹) 2012/03/17

けいじゅ@いしつかです.

[#45381] Re: Marshal.dumpにおけるインスタンス変数の取り扱いについて — Yukihiro Matsumoto <matz@...> 2012/03/17

まつもと ゆきひろです

[#45399] Re: Marshal.dumpにおけるインスタンス変数の取り扱いについて — keiju@... (石塚圭樹) 2012/03/18

けいじゅ@いしつかです.

[#45412] [ruby-trunk - Feature #6177][Open] array.cのrb_ary_equal()の高速化 — "Glass_saga (Masaki Matsushita)" <glass.saga@...>

13 messages 2012/03/20

[#45471] [ruby-trunk - Bug #6230][Open] [WEBrick] WEBrick::HTTPResponse#body の IO オブジェクトの読み込みに read メソッドを使っているため必要以上にブロックされる — "nobuoka (yu nobuoka)" <nobuoka@...>

7 messages 2012/03/30

[ruby-dev:45305] [ruby-trunk - Bug #6109][Closed] plain-char for isdigit(), etc

From: tadayoshi funaba <redmine@...>
Date: 2012-03-03 03:14:39 UTC
List: ruby-dev #45305
Issue #6109 has been updated by tadayoshi funaba.

Status changed from Open to Closed


----------------------------------------
Bug #6109: plain-char for isdigit(), etc
https://bugs.ruby-lang.org/issues/6109

Author: Nobuyoshi Nakada
Status: Closed
Priority: Low
Assignee: tadayoshi funaba
Category: ext
Target version: 
ruby -v: r34880


=begin
cygwinで、以下のように((%date%))で警告が出ます。
  compiling date_parse.c
  date_parse.c: In function ‘s3e’:
  date_parse.c:92:2: 警告: array subscript has type ‘char’
  date_parse.c:141:2: 警告: array subscript has type ‘char’
  date_parse.c:173:2: 警告: array subscript has type ‘char’
  date_parse.c:195:2: 警告: array subscript has type ‘char’
  date_parse.c: In function ‘date_zone_to_diff’:
  date_parse.c:384:2: 警告: array subscript has type ‘char’
  date_parse.c:390:6: 警告: array subscript has type ‘char’
  date_parse.c:391:3: 警告: array subscript has type ‘char’
  date_parse.c: In function ‘parse_ddd_cb’:
  date_parse.c:1416:6: 警告: array subscript has type ‘char’
  date_parse.c: In function ‘check_class’:
  date_parse.c:1523:6: 警告: array subscript has type ‘char’
  date_parse.c:1525:6: 警告: array subscript has type ‘char’
  compiling date_strftime.c
  compiling date_strptime.c
  date_strptime.c: In function ‘num_pattern_p’:
  date_strptime.c:61:5: 警告: array subscript has type ‘char’
  date_strptime.c:68:6: 警告: array subscript has type ‘char’
  date_strptime.c: In function ‘date__strptime_internal’:
  date_strptime.c:627:6: 警告: array subscript has type ‘char’

これらは(({isdigit()})), (({isspace()})), (({isalpha()}))などを(({plain char}))に対して使っているためです。

cygwinの((%ctype.h%))から引用:
  /* These macros are intentionally written in a manner that will trigger
     a gcc -Wall warning if the user mistakenly passes a 'char' instead
     of an int containing an 'unsigned char'.  Note that the sizeof will
     always be 1, which is what we want for mapping EOF to __ctype_ptr__[0];
     the use of a raw index inside the sizeof triggers the gcc warning if
     __c was of type char, and sizeof masks side effects of the extra __c.
     Meanwhile, the real index to __ctype_ptr__+1 must be cast to int,
     since isalpha(0x100000001LL) must equal isalpha(1), rather than being
     an out-of-bounds reference on a 64-bit machine.  */
  #define __ctype_lookup(__c) ((__ctype_ptr__+sizeof(""[__c]))[(int)(__c)])

わざわざ(({unsigned char}))以外を使うと警告するようにしてあるということです。

また、Linuxの((%ctype%))のmanpageでも以下のように明確に規定されています。
  説明
       これらの関数は、現在のロケールに従って c を分類する。 c は unsigned char か EOF でなければならない。

つまり、(({plain char}))(または、あまりなさそうですが、(({signed char})))を(({isalpha()})), (({isspace()})), (({isdigit()}))などに使うことは誤りです。代わりに(({ISALPHA()}))などを使うか、明示的に(({unsigned char}))にキャストすべきです。

=end



-- 
http://bugs.ruby-lang.org/

In This Thread

Prev Next