Skip to content

Conversation

@akinomyoga
Copy link
Member

変換結果確認用

@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2025

プレビュー (HTML) (更新時刻: 2025-12-03 23:41:42 JST)

  • Commit: 3dc2885
  • プレビューの生成には時間がかかります (3~5分)。進捗状況はこちらをご確認ください。

変更記事一覧

1件の記事が変更されました。

※ソース (.md) に直接変更のあった記事を列挙しています。グローバル修飾や変換規則の変更による変化は考慮していません。

@akinomyoga akinomyoga changed the title fix(cstdlib/mblen): 追加修正 [WIP] fix(cstdlib/mblen): 追加修正 Dec 3, 2025
@akinomyoga
Copy link
Member Author

mblen のシフト状態に関する記述が巷の記述とC規格の記述で違うと思ったら、POSIX.1-2017 規格 (前回のシフト状態を使う) までは C 規格と違う記述になっていて、その後 POSIX.1-2024 (毎回シフト状態をクリアする) で C 規格に一致する様に改められたみたいです。一方で GNU/Linux は POSIX.1-2017 の振る舞い で、今後も C/POSIX に従うつもりはないんだろうな…という状況です。

* std::mblen の内部状態をクリアせずに使用しているのを修正
* size_t に対する std::size_t のつけ忘れを修正
* nullptr を指定した時の戻り値の記述を修正
* 関連するロカールカテゴリを明記
#include <cstdlib>
#include <clocale>
int main() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::strlen のために #include <cstring> が必要です(2つ目のサンプルコードでも同様)。

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

そうですね!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commit 4a9b887 更新しました! ありがとうございます!

akinomyoga and others added 2 commits December 3, 2025 23:33
残り MB_CUR_MAX バイトが読み取れることが保証されていないと未定義動作

Co-authored-by: Raclamusi <61970673+Raclamusi@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants