Skip to content

【2.1节 常量】nullptr 增改示例代码 #132

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

Closed
sunshaoce opened this issue Oct 2, 2020 · 1 comment · Fixed by #133
Closed

【2.1节 常量】nullptr 增改示例代码 #132

sunshaoce opened this issue Oct 2, 2020 · 1 comment · Fixed by #133

Comments

@sunshaoce
Copy link
Contributor

动机

增改一点示例代码,以拓宽示例的适配范围。

需求说明

  if (std::is_same<decltype(NULL), decltype(0)>::value)
    std::cout << "NULL == 0" << std::endl;

因为在Ubuntu 18.04环境下的clang++是long类型。我这里提供一个简单的思路,不过实现肯定不够优雅简洁。

  if (std::is_same<decltype(NULL), decltype(0)>::value ||
      std::is_same<decltype(NULL), decltype(0L)>::value)
    std::cout << "NULL == 0" << std::endl;
@changkun
Copy link
Owner

changkun commented Oct 2, 2020

PR welcome

changkun added a commit that referenced this issue Oct 20, 2020
This is a bug introduced in #132.

Fixes #136
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants