-
Notifications
You must be signed in to change notification settings - Fork 176
include tchar.h 削除 #2108
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?
include tchar.h 削除 #2108
Conversation
berryzplus
left a comment
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.
全体的に「しなくてよい変更」に見えます。
sakura_core/CGrepEnumFileBase.h
Outdated
| #include <windows.h> | ||
| #include <string.h> | ||
| #include <tchar.h> | ||
| #include <wchar.h> |
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.
置換より削除がベターと思います。
プリコンパイル済みヘッダーでまとめてインクルードするように変えているため。
| #include <wchar.h> |
| //! デバッグ判別、定数サフィックス 2007.09.20 kobake | ||
| #ifdef _DEBUG | ||
| #define _DEBUG_SUFFIX_ "_DEBUG" | ||
| #define _DEBUG_SUFFIX_ L"_DEBUG" |
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.
主題と無関係と思います。
似たようなのたくさんあるけど、横並びでNG。
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.
この部分について、
「常にワイド文字列として使われる定数をナロー文字列で宣言するのはおかしい」
の理屈は理解できます。
純粋に「変える必要あるの?ないの?」で考えたときに「ない側に振れるんじゃないか」と言ってます。
| #define STR_SHAREDATA_VERSION NUM_TO_STR(N_SHAREDATA_VERSION) | ||
| #define GSTR_SHAREDATA (L"SakuraShareData" _T(CON_SKR_MACHINE_SUFFIX_) _T(_CODE_SUFFIX_) _T(_DEBUG_SUFFIX_) _T(STR_SHAREDATA_VERSION)) | ||
| #define STR_SHAREDATA_VERSION TEXT(NUM_TO_STR(N_SHAREDATA_VERSION)) | ||
| #define GSTR_SHAREDATA (L"SakuraShareData" CON_SKR_MACHINE_SUFFIX_ _CODE_SUFFIX_ _DEBUG_SUFFIX_ STR_SHAREDATA_VERSION) |
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.
_T() よりも TEXT() のがわかりやすい、は個人の主観であるように思います。
他ファイルでは tchar.h が不要になった。←了解。
tchar.h で定義していたマクロが使えなくなったので代替マクロを使う ←なんで?
a540d29 to
913d84a
Compare
berryzplus
left a comment
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.
_T()をTEXT()に置き換える理由がありません。
- 置き替えたい理由
- 置き換えたほうがよい理由
- 置き替えないといけない理由
特に理由がなければ、TEXT()よりも_T()のほうが短いため、「可能であれば短い記述が好ましい」の一般論に従って reject する感じになります。
他の部分で tchar.h の include を削除するのは構いませんが、
_T() を使うファイルでは (必要なので) tchar.h の include を残す、になると思います。
913d84a to
a0a1e0a
Compare
|
berryzplus
left a comment
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.
レビュー結果更新します。
- 不要になっている tchar.h のインクルードを削除。 ←同意できます。
- 文字列定数の定義に
_T()の代わりに ワイドサフィックス を使う。 ←同意できません。
Pull Requestを分割したら論点がより明確になるのではないかと思います。


PR対象
カテゴリ
PR の背景
Unicode版のみ対応だが、tchar.h をincludeしている。
これまでの対応が不十分で、tchar.h を使用する関数が残っていたため、
#2066
で削除した。
仕様・動作説明
PR の影響範囲
影響なし。
テスト内容
96af681
Debug/Win32 build 時のプリプロセッサ処理結果
96af681
関連 issue, PR
#2066
参考資料
https://learn.microsoft.com/ja-jp/windows/win32/api/winnt/nf-winnt-text