Skip to content

Commit 9585f2c

Browse files
docs: update Codes/README.md — document _DEBUG guard as recommended approach (#1517)
* docs: update Codes/README.md to document _DEBUG guard usage The repo's .vscode/tasks.json passes -D_DEBUG in both g++ (Windows) and clang++ (macOS) build tasks, and c_cpp_properties.json also defines _DEBUG for IntelliSense on both platforms. Update the README to document this cross-platform _DEBUG guard as the recommended approach alongside the existing _WIN32 example. Ref: #1516 (review comment r3106352313) * docs: simplify — just replace _WIN32 with _DEBUG and note its origin Revert the previous over-engineered change. Keep it minimal: - Replace #ifdef _WIN32 with #ifdef _DEBUG - Add one line explaining where _DEBUG is defined * docs: minimal update — use _DEBUG guard and note its origin Replace _WIN32 with _DEBUG in both code examples, add one-line explanation of where _DEBUG is defined. No other structural changes. * fix: restore original text, only change _WIN32→_DEBUG and intro line Address review: revert all unintended changes (Chinese quote escaping, trailing newline, structural changes). Only 3 lines differ from master: - Line 50: intro text updated to mention _DEBUG origin - Line 53: #ifdef _WIN32 → #ifdef _DEBUG - Line 63: #ifdef _WIN32 → #ifdef _DEBUG * docs: _DEBUG by hand Update README.md * fix: 虽然最好有个空格,但是得到准许前还是不修改比较好 Update README.md * docs: rust->Rust * docs: 加个结尾句号 Update Codes/README.md --------- Co-authored-by: gh-pr-review[bot] <268385713+gh-pr-review[bot]@users.noreply.github.com> Co-authored-by: gh-pr-review <github-gh-pr-review@cmail.letmefly.xyz>
1 parent c3797c6 commit 9585f2c

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

Codes/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,22 @@ LeetCode很多题不需要写头文件、main函数等,因此在本地编写
4747

4848
如何解决这个问题呢?只需引入```Codes```下的```_[1,2]toVector.h```即可。
4949

50-
如果你使用的是Windows,引入方式:
50+
引入方式:
5151

5252
```cpp
53-
#ifdef _WIN32
53+
#ifdef _DEBUG
5454
#include "_[1,2]toVector.h"
5555
#endif
5656
```
5757

58+
(其中`_DEBUG`[`c_cpp_properties.json`](https://github.com/LetMeFly666/LeetCode/blob/c3797c6100e0581d2658b6e334aa1d639d4a8f8c/.vscode/c_cpp_properties.json#L25)(IDE插件用)和[`.vscode/tasks.json`](https://github.com/LetMeFly666/LeetCode/blob/c3797c6100e0581d2658b6e334aa1d639d4a8f8c/.vscode/tasks.json#L34)(编译用)中的`-D_DEBUG`编译参数定义)
59+
5860
然后就可以编写LeetCode的代码了。
5961

6062
```_[1,2]toVector.h```中包含了很多LeetCode中常用的数据结构,如果想在本地调试,可以在文件尾部加上代码如:
6163

6264
```cpp
63-
#ifdef _WIN32
65+
#ifdef _DEBUG
6466
int main() {
6567
string s;
6668
while (cin >> s) {
@@ -76,4 +78,4 @@ int main() {
7678

7779
## 其他文件
7880

79-
`cargo.lock``cargo.toml``lib.rs`都是rust所需
81+
`cargo.lock``cargo.toml``lib.rs`都是Rust所需。

0 commit comments

Comments
 (0)