0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ssize_tについて

Posted at

mrubyでssize_tが使われてコンパイルエラーになってしまいました。

issueを上げてみたのですが、matzさんが対応してくれました。

環境はgcc4+newlib3です。

C言語のintやlongはCコンパイラーの中で解釈されます。

しかしssize_tはコンパイラーの中ではなくて、libcのヘッダーで定義されたものになります。newlib3の場合

newlib/libc/include/sys/types.h
typedef _ssize_t ssize_t;

となっています。_ssize_tは

newlib/libc/include/sys/_types.h
typedef long _ssize_t;

となっています。

これまでmrubyでlibcのsys以下のヘッダーをincludeしているのはsrc/gc.cだけでした。

libcはnewlibが代表的な実装になりますが、他にもいろいろあります。私はsys以下のヘッダーはlibcの実装に依存する可能性が高くなりできる限り使わないほうが良いのではないかと思います。

0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?