Skip to content

Conversation

@shiracamus
Copy link
Contributor

@shiracamus shiracamus commented Nov 1, 2025

C言語は参照渡しできない言語なのでC++言語のコードに置き換えました。
値渡しと参照渡しの説明を補足してみました。

close #739


Note

Rewrites and expands docs/reference/functions/pass-by-value.md to clarify pass-by-value vs pass-by-reference (C++ examples) and JavaScript’s pass-by-value with object sharing behavior.

  • Docs: docs/reference/functions/pass-by-value.md
    • Conceptual clarifications:
      • Add section on variable kinds (value vs reference types) and how values/refs are passed.
      • Refine definitions of value-passing (copy vs shared reference copy) and reference-passing (variable sharing).
    • Examples:
      • Replace C samples with C++ implementations for value-pass and reference-pass using int and references; switch output to std::println.
      • Expand JavaScript section: reaffirm all args are pass-by-value; illustrate object sharing, reassignment breaking sharing, and effects in function arguments.
    • Edits: Polish headings/wording and update summary bullet list.

Written by Cursor Bugbot for commit 26c3892. This will update automatically on new commits. Configure here.

値渡しと参照渡しの説明を補足てみました。
C言語は参照渡しできない言語なのでC++言語のコードに置き換えました。
@vercel
Copy link

vercel bot commented Nov 1, 2025

@shiracamus is attempting to deploy a commit to the YYTypescript Team on Vercel.

A member of the Team first needs to authorize it.

@shiracamus shiracamus closed this Nov 1, 2025
@shiracamus shiracamus reopened this Nov 1, 2025
@vercel
Copy link

vercel bot commented Nov 2, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
book Ready Ready Preview Comment Nov 14, 2025 10:29am

リストマークダウンがエラーになるようなので元の記述に戻す(改行するように末尾に空白2個を付ける)
cursor[bot]

This comment was marked as outdated.

PostILearned内の行末の空白を削除
実引数と仮引数の説明を追加。コードにコメント追加。説明補足。
値渡しコードのコメントに合わせて参照型コードのコメント削除
参照値について説明追加
変数の種類を独立セクションにする
Copy link
Contributor

@tats-u tats-u left a comment

Choose a reason for hiding this comment

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

対比しやすいようにC言語の書き方でC++コードを書いていることを補足
コードの色付けが変わって対比しずらくなったのでコードブロックの言語指定をcppではなくcにしておく。
値型変数も参照型変数も値渡しと参照渡しができる説明を変数の種類のところに移動
ノットイコールの記入ミス修正
Wikipediaに書いてある「参照の値渡し」を追記
Copy link
Contributor

@tats-u tats-u left a comment

Choose a reason for hiding this comment

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

値型の方もC++23に書き換える場合

C++コードの書き方で統一しました
Copy link
Contributor

@tats-u tats-u left a comment

Choose a reason for hiding this comment

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

模範的なコードなのでreturn 0;はあったほうがいいですね(なんで今までなかったんだ・・・)

prettierエラー対処
@shiracamus
Copy link
Contributor Author

Prettierでエラーが出ていたので修正しました。

@suin suin merged commit ecae7df into yytypescript:master Nov 18, 2025
11 checks passed
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.

「参照渡し」の例にC言語以外の例を引き合いに出しませんか?

3 participants