[#26975] [proposal] ANSI style function — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>

山本です。

56 messages 2005/09/07
[#26976] Re: [proposal] ANSI style function — Yukihiro Matsumoto <matz@...> 2005/09/07

まつもと ゆきひろです

[#26977] Re: [proposal] ANSI style function — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/07

山本です。

[#26978] Re: [proposal] ANSI style function — nobu@... 2005/09/07

なかだです。

[#26979] Re: [proposal] ANSI style function — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/07

山本です。

[#26980] Re: [proposal] ANSI style function — Yukihiro Matsumoto <matz@...> 2005/09/07

まつもと ゆきひろです

[#26983] Re: [proposal] ANSI style function — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/08

山本です。

[#26988] Re: [proposal] ANSI style function — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/08

山本です。

[#26989] Re: [proposal] ANSI style function — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/08

山本です。

[#26990] Re: [proposal] ANSI style function — Yukihiro Matsumoto <matz@...> 2005/09/08

まつもと ゆきひろです

[#26991] Re: [proposal] ANSI style function — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/08

山本です。

[#26995] Re: [proposal] ANSI style function — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/09

山本です。

[#26996] Re: [proposal] ANSI style function — Yukihiro Matsumoto <matz@...> 2005/09/09

まつもと ゆきひろです

[#26998] Re: [proposal] ANSI style function — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/09

山本です。

[#27000] Re: [proposal] ANSI style function — Takahiro Kambe <taca@...> 2005/09/09

In message <20050909220539.E1B26BB8.ocean@m2.ccsnet.ne.jp>

[#27001] Re: [proposal] ANSI style function — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/10

山本です。

[#27002] Re: [proposal] ANSI style function — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/10

山本です。

[#27003] Re: [proposal] ANSI style function — Yukihiro Matsumoto <matz@...> 2005/09/10

まつもと ゆきひろです

[#27004] Re: [proposal] ANSI style function — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/10

山本です。

[#27005] Re: [proposal] ANSI style function — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/10

山本です。

[#27006] Re: [proposal] ANSI style function — Yukihiro Matsumoto <matz@...> 2005/09/10

まつもと ゆきひろです

[#27007] Re: [proposal] ANSI style function — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/10

山本です。

[#27008] Re: [proposal] ANSI style function — Yukihiro Matsumoto <matz@...> 2005/09/10

まつもと ゆきひろです

[#27009] Re: [proposal] ANSI style function — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/10

山本です。

[#27011] Re: [proposal] ANSI style function — Yukihiro Matsumoto <matz@...> 2005/09/10

まつもと ゆきひろです

[#27013] Re: [proposal] ANSI style function — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/10

山本です。

[#27016] Re: [proposal] ANSI style function — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/11

山本です。

[#27015] Re: [proposal] ANSI style function — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/11

山本です。

[#26984] elimination of "extern int errno;" — Takahiro Kambe <taca@...>

こんにちは。

48 messages 2005/09/08
[#27023] sizeof(FILE) problem on DragonFly BSD — Takahiro Kambe <taca@...> 2005/09/12

In message <20050908.120716.71112483.taca@back-street.net>

[#27024] Re: sizeof(FILE) problem on DragonFly BSD — Yukihiro Matsumoto <matz@...> 2005/09/12

まつもと ゆきひろです

[#27025] Re: sizeof(FILE) problem on DragonFly BSD — Takahiro Kambe <taca@...> 2005/09/12

In message <1126489480.743964.31599.nullmailer@x31.priv.netlab.jp>

[#27027] Re: sizeof(FILE) problem on DragonFly BSD — Takahiro Kambe <taca@...> 2005/09/12

In message <20050912.104954.92585084.taca@back-street.net>

[#27029] Re: sizeof(FILE) problem on DragonFly BSD — Yukihiro Matsumoto <matz@...> 2005/09/12

まつもと ゆきひろです

[#27035] Re: sizeof(FILE) problem on DragonFly BSD — "U.Nakamura" <usa@...> 2005/09/12

こんにちは、なかむら(う)です。

[#27036] Re: sizeof(FILE) problem on DragonFly BSD — Yukihiro Matsumoto <matz@...> 2005/09/12

まつもと ゆきひろです

[#27079] ruby-1.8.3 status for release (Re: Re: sizeof(FILE) problem on DragonFly BSD) — Masayoshi Takahashi <maki@...> 2005/09/15

高橋征義です。

[#27081] Re: ruby-1.8.3 status for release (Re: Re: sizeof(FILE) problem on DragonFly BSD) — Yukihiro Matsumoto <matz@...> 2005/09/15

まつもと ゆきひろです

[#27082] Re: ruby-1.8.3 status for release — Masayoshi Takahashi <maki@...> 2005/09/15

高橋征義です。

[#27083] Re: ruby-1.8.3 status for release — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/15

山本です。

[#27099] Re: ruby-1.8.3 status for release — Hidetoshi NAGAI <nagai@...> 2005/09/15

永井@知能.九工大です.

[#27531] ruby/tk installation without tcl/tk (for 1.8.4) — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/10/26

山本です。

[#27619] Re: ruby/tk installation without tcl/tk (for 1.8.4) — Hidetoshi NAGAI <nagai@...> 2005/11/02

永井@知能.九工大です.

[#27139] ruby-1.8.3 status for release — Masayoshi Takahashi <maki@...>

高橋征義です。

66 messages 2005/09/18
[#27193] Re: ruby-1.8.3 status for release — TAKAHASHI Masayoshi <maki@...> 2005/09/20

高橋征義です。

[#27251] 脆弱性レポート翻訳者募集 — Yukihiro Matsumoto <matz@...>

まつもと ゆきひろです

13 messages 2005/09/21

[#27321] RubyGemsとOS platformとの関係 — Daigo Moriwaki <techml@...>

こんにちは、森脇です。

42 messages 2005/09/26
[#27327] Re: RubyGemsとOS platformとの関係 — nobuyoshi nakada <nobuyoshi.nakada@...> 2005/09/27

なかだです。

[#27330] Re: RubyGemsとOS platformとの関係 — Yukihiro Matsumoto <matz@...> 2005/09/27

まつもと ゆきひろです

[#27337] Re: RubyGems と OS platform との関係 — NISHIO Mizuho <jurader@...> 2005/09/27

西尾瑞穂 と言います。

[#27343] Re: RubyGems と OS platform との関係 — Yukihiro Matsumoto <matz@...> 2005/09/28

まつもと ゆきひろです

[#27347] Re: RubyGems と OS platform との関係 — Tanaka Akira <akr@...17n.org> 2005/09/28

In article <1127872084.608903.6359.nullmailer@x31.priv.netlab.jp>,

[#27348] Re: RubyGems と OS platform との関係 — Yukihiro Matsumoto <matz@...> 2005/09/28

まつもと ゆきひろです

[#27359] Re: RubyGems と OS platform との関係 — Daigo Moriwaki <techml@...> 2005/09/28

森脇です。

[#27364] Re: RubyGems と OS platform との関係 — akira yamada / やまだあきら <akira@...> 2005/09/30

Daigo Moriwaki wrote:

[#27365] Re: RubyGems と OS platform との関係 — Tanaka Akira <akr@...17n.org> 2005/09/30

In article <433CC31E.20802@ruby-lang.org>,

[#27367] Re: RubyGems と OS platform との関係 — akira yamada / やまだあきら <akira@...> 2005/09/30

Tanaka Akira wrote:

[#27369] Re: RubyGems と OS platform との関係 — Tanaka Akira <akr@...17n.org> 2005/10/01

In article <433D4CED.9030005@ruby-lang.org>,

[ruby-dev:27047] Re: [proposal] ANSI style function

From: nobu@...
Date: 2005-09-12 12:52:32 UTC
List: ruby-dev #27047
なかだです。

At Mon, 12 Sep 2005 00:56:36 +0900,
Tanaka Akira wrote in [ruby-dev:27019]:
> ただ、rb_thread_create についていえば引数は VALUE (*)(VALUE) で受けて
> VALUE (*)(VALUE, rb_thread_t) に cast してから rb_thread_start_0 にわ
> たせばいいことだと思います。

関数ポインタのキャストは基本的に避けたほうが無難じゃないでしょ
うか。rb_thread_tが必要なら、opaqueな型でtypedefしておくので充
分だと思います。

> > というわけで、放置するのは良くないような気がしてきました。typedef void* VALUE とすれば
> > 64bit 環境でも問題ない可能性はありますが、そのかわりコールバック側で VALUE * で受けたり、
> > struct のポインタで受けたりはできなくなるんじゃないでしょうか。
> 
> ここで述べられている理由はよくわかりませんが、個人的には VALUE は
> void* にするのが適切であろうと思っています。
> 
> それは、AS/400 なるシステムではポインタと同じサイズの整数型が存在しな
> いということを知ってしまったというのが理由です。

ということは関数ポインタをcastして呼び出すことは保証されないん
じゃないでしょうか。

とりあえずapply2files()のコールバックを修正してみました。


Index: file.c
===================================================================
RCS file: /cvs/ruby/src/ruby/file.c,v
retrieving revision 1.201
diff -U2 -p -r1.201 file.c
--- file.c	12 Sep 2005 10:44:20 -0000	1.201
+++ file.c	12 Sep 2005 12:43:51 -0000
@@ -98,5 +98,5 @@ rb_get_path(VALUE obj)
 
 static long
-apply2files(void (*func) (/* ??? */), VALUE vargs, void *arg)
+apply2files(void (*func)(const char *, void *), VALUE vargs, void *arg)
 {
     long i;
@@ -1276,7 +1276,5 @@ test_grpowned(VALUE obj, VALUE fname)
 #if defined(S_ISUID) || defined(S_ISGID) || defined(S_ISVTX)
 static VALUE
-check3rdbyte(fname, mode)
-    VALUE fname;
-    int mode;
+check3rdbyte(VALUE fname, int mode)
 {
     struct stat st;
@@ -1359,5 +1357,5 @@ rb_file_s_size(VALUE klass, VALUE fname)
 
 static VALUE
-rb_file_ftype(struct stat *st)
+rb_file_ftype(const struct stat *st)
 {
     char *t;
@@ -1562,7 +1560,7 @@ rb_file_ctime(VALUE obj)
 
 static void
-chmod_internal(const char *path, int mode)
+chmod_internal(const char *path, void *mode)
 {
-    if (chmod(path, mode) < 0)
+    if (chmod(path, (int)mode) < 0)
 	rb_sys_fail(path);
 }
@@ -1634,9 +1632,7 @@ rb_file_chmod(VALUE obj, VALUE vmode)
 #if defined(HAVE_LCHMOD)
 static void
-lchmod_internal(path, mode)
-    const char *path;
-    int mode;
+lchmod_internal(const char *path, void *mode)
 {
-    if (lchmod(path, mode) < 0)
+    if (lchmod(path, (int)mode) < 0)
 	rb_sys_fail(path);
 }
@@ -1653,7 +1649,5 @@ lchmod_internal(path, mode)
 
 static VALUE
-rb_file_s_lchmod(argc, argv)
-    int argc;
-    VALUE *argv;
+rb_file_s_lchmod(int argc, VALUE *argv)
 {
     VALUE vmode;
@@ -1682,6 +1676,7 @@ struct chown_args {
 
 static void
-chown_internal(const char *path, struct chown_args *args)
+chown_internal(const char *path, void *arg)
 {
+    struct chown_args *args = arg;
     if (chown(path, args->owner, args->group) < 0)
 	rb_sys_fail(path);
@@ -1768,8 +1763,7 @@ rb_file_chown(VALUE obj, VALUE owner, VA
 #if defined(HAVE_LCHOWN) && !defined(__CHECKER__)
 static void
-lchown_internal(path, args)
-    const char *path;
-    struct chown_args *args;
+lchown_internal(const char *path, void *arg)
 {
+    struct chown_args *args = arg;
     if (lchown(path, args->owner, args->group) < 0)
 	rb_sys_fail(path);
@@ -1789,7 +1783,5 @@ lchown_internal(path, args)
 
 static VALUE
-rb_file_s_lchown(argc, argv)
-    int argc;
-    VALUE *argv;
+rb_file_s_lchown(int argc, VALUE *argv)
 {
     VALUE o, g, rest;
@@ -1828,8 +1820,7 @@ struct timeval rb_time_timeval(VALUE tim
 
 static void
-utime_internal(path, tvp)
-    char *path;
-    struct timeval tvp[];
+utime_internal(const char *path, void *arg)
 {
+    struct timeval *tvp = arg;
     if (utimes(path, tvp) < 0)
 	rb_sys_fail(path);
@@ -1846,7 +1837,5 @@ utime_internal(path, tvp)
 
 static VALUE
-rb_file_s_utime(argc, argv)
-    int argc;
-    VALUE *argv;
+rb_file_s_utime(int argc, VALUE *argv)
 {
     VALUE atime, mtime, rest;
@@ -1873,6 +1862,7 @@ struct utimbuf {
 
 static void
-utime_internal(const char *path, struct utimbuf *utp)
+utime_internal(const char *path, void *arg)
 {
+    struct utimbuf *utp = arg;
     if (utime(path, utp) < 0)
 	rb_sys_fail(path);
@@ -2015,5 +2005,5 @@ rb_file_s_readlink(VALUE klass, VALUE pa
 
 static void
-unlink_internal(const char *path)
+unlink_internal(const char *path, void *arg)
 {
     if (unlink(path) < 0)
@@ -3842,6 +3832,5 @@ is_absolute_path(const char *path)
 #ifndef DOSISH
 static int
-path_check_1(path)
-     VALUE path;
+path_check_1(VALUE path)
 {
     struct stat st;
@@ -3883,8 +3872,8 @@ path_check_1(path)
 
 int
-rb_path_check(char *path)
+rb_path_check(const char *path)
 {
 #ifndef DOSISH
-    char *p0, *p, *pend;
+    const char *p0, *p, *pend;
     const char sep = PATH_SEP_CHAR;
 
@@ -3911,6 +3900,5 @@ rb_path_check(char *path)
 #if defined(__MACOS__) || defined(riscos)
 static int
-is_macos_native_path(path)
-    const char *path;
+is_macos_native_path(const char *path)
 {
     if (strchr(path, ':')) return 1;
@@ -3920,5 +3908,5 @@ is_macos_native_path(path)
 
 static int
-file_load_ok(char *file)
+file_load_ok(const char *file)
 {
     FILE *f;
Index: intern.h
===================================================================
RCS file: /cvs/ruby/src/ruby/intern.h,v
retrieving revision 1.178
diff -U2 -p -r1.178 intern.h
--- intern.h	30 Aug 2005 14:49:51 -0000	1.178
+++ intern.h	12 Sep 2005 12:20:27 -0000
@@ -324,5 +324,5 @@ VALUE rb_hash_aset _((VALUE, VALUE, VALU
 VALUE rb_hash_delete_if _((VALUE));
 VALUE rb_hash_delete _((VALUE,VALUE));
-int rb_path_check _((char*));
+int rb_path_check _((const char*));
 int rb_env_path_tainted _((void));
 /* io.c */


-- 
--- 僕の前にBugはない。
--- 僕の後ろにBugはできる。
    中田 伸悦

In This Thread