-
Notifications
You must be signed in to change notification settings - Fork 170
new page bufsiz.md #1477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
new page bufsiz.md #1477
Conversation
確認をお願いします。 |
⚡ プレビュー (HTML) (更新時刻: 2025-07-20 20:12:07 JST) 変更記事一覧2件の記事が変更されました。 ※ソース (.md) に直接変更のあった記事を列挙しています。グローバル修飾や変換規則の変更による変化は考慮していません。 |
Co-authored-by: Koichi Murase <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
特に他の方からのコメントもないようなのでOK
因みに Linux で最も一般的な glibc では 8192 です (プレビューのコードブロックに表示される実行ボタンを押してもそれがわかりますね)。 newlib/bionic/musl および Minix, FreeBSD では 1024 でした。
ありがとうございます。 |
うーん…一般的に 1024 というのは何処が出典ですか? |
実行環境依存なので、調べていると1024が多そうに見えました。
|
1つ目は環境不明(2007年頃)で、2つ目は(標準ライブラリのBUFSIZの話ではなくて)自分で定義した $ x86_64-w64-mingw32-gcc -xc - <<< $'#include <stdio.h>\nint main(){char b[BUFSIZ];setbuf(stdout,b);}'
$ objdump -x a.exe | sed -n '/msvcrt\.dll/,/^$/p'
DLL Name: msvcrt.dll
vma: Ordinal Hint Member-Name Bound-To
000081c0 <none> 0059 __C_specific_handler
000081c8 <none> 0081 __getmainargs
000081d0 <none> 0082 __initenv
000081d8 <none> 0083 __iob_func
000081e0 <none> 0093 __set_app_type
000081e8 <none> 0095 __setusermatherr
000081f0 <none> 00ae _amsg_exit
000081f8 <none> 00cb _cexit
00008200 <none> 00dd _commode
00008208 <none> 0143 _fmode
00008210 <none> 019f _initterm
00008218 <none> 02c4 _onexit
00008220 <none> 0475 abort
00008228 <none> 0486 calloc
00008230 <none> 0494 exit
00008238 <none> 04a8 fprintf
00008240 <none> 04b1 free
00008248 <none> 04bd fwrite
00008250 <none> 04ec malloc
00008258 <none> 04f5 memcpy
00008260 <none> 0512 setbuf
00008268 <none> 0516 signal
00008270 <none> 052c strlen
00008278 <none> 052f strncmp
00008280 <none> 0553 vfprintf なので msvcrt は 512 ということ。 以下によると The Unix Programming Environment (1984) に 512 または 1024 が最も多く使われると書かれているみたいですが…(でも40年前の情報…) 以下は 512~8192 と書いています (さすがきじねこ…) ところで上の記事に
って書いてあって、えって思ったら、7.21.2/p9 にちゃんとそう書かれていますね…。 |
ありがとうございます。 MinGW環境でもMSVCの古いランタイムが使われているのですね。 |
例えば下記のように明記してもよいかもですね。
FYI: C標準規格では "at least N" という言い回しが頻出し、全ての処理系に求める最低保証ラインを定義していたりします。 |
|
こちらの方はそのままプッシュしても良いですか? |
ok |
こんな感じでどうでしょうか? |
良いと思います! 後で何処に経緯があったかわからなくなるので commit message にリンクがあると良いです。
個人的には、一文を無駄に長くする理由もないので、文を切ってもいいかな ( |
あ、もう push されているから commit message 弄れないですね… |
すみません。すみません。関連するものに次回からは貼るようにします。 |
No description provided.