Skip to content
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

Use C++ 'nullptr' in place of 'NULL' #13944

Merged
merged 1 commit into from
May 9, 2019

Conversation

thinkyhead
Copy link
Member

It is now recommended to use nullptr which is the C++ language-supported equivalent to the NULL macro. Other than being a language built-in and not a macro, there are some minor advantages to this small modernization, such as not needing to cast nullptr to the current pointer type.

@ManuelMcLure
Copy link
Contributor

Looks like it already found somewhere NULL was being used incorrectly.

@ManuelMcLure
Copy link
Contributor

ManuelMcLure commented May 8, 2019

My search for places where there's a (<type>*)0 shows the following locations:

  • src/HAL/HAL_AVR/endstop_interrupts.h lines 57 & 67
  • src/HAL/HAL_STM32F4/HAL_spi_STM32F4.cpp line 168

No other occurrences that I can find with regular expression \*\s*)\s*0 other than some false positives where there is a cast from a hex constant to a pointer type.

@InsanityAutomation
Copy link
Contributor

As a side note, the null pointers in host_actions caused pio to fail compiling todays build which is what prompted me to look at this. I replaced null with nullptr and all is well, just on the 2 lines in the header.

@thinkyhead thinkyhead force-pushed the bf2_nullptr_pr branch 2 times, most recently from 9094d88 to fe60ab4 Compare May 9, 2019 03:09
@thinkyhead thinkyhead merged commit ad4ffa1 into MarlinFirmware:bugfix-2.0.x May 9, 2019
@thinkyhead thinkyhead deleted the bf2_nullptr_pr branch May 9, 2019 16:45
ozgunawesome pushed a commit to ozgunawesome/Marlin that referenced this pull request May 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants