-
Notifications
You must be signed in to change notification settings - Fork 172
[WIP] fix(cstdlib/mblen): 追加修正 #1541
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
base: master
Are you sure you want to change the base?
Conversation
|
⚡ プレビュー (HTML) (更新時刻: 2025-12-03 23:41:42 JST) 変更記事一覧1件の記事が変更されました。 ※ソース (.md) に直接変更のあった記事を列挙しています。グローバル修飾や変換規則の変更による変化は考慮していません。 |
|
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() { |
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.
std::strlen のために #include <cstring> が必要です(2つ目のサンプルコードでも同様)。
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.
そうですね!
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.
commit 4a9b887 更新しました! ありがとうございます!
残り MB_CUR_MAX バイトが読み取れることが保証されていないと未定義動作 Co-authored-by: Raclamusi <61970673+Raclamusi@users.noreply.github.com>
変換結果確認用