pico-ssd1306 icon indicating copy to clipboard operation
pico-ssd1306 copied to clipboard

#pragma once and #ifdef/#define are redundant

Open FunMiles opened this issue 3 years ago • 2 comments

Every include file starts with #pragma once and continues with #ifndef FILENAME_H and #define FILENAME_H The two methods do fundamentally the same thing. I would remove the #ifndef / #define / #endif as it is more verbose and supposedly, #pragma once can be more efficient. Supposedly, not all compilers have supported #pragma once, but GCC and Clang do and I have yet to encounter a modern compiler that does not. The pico SDK uses GCC, so even if some exotic compiler does not like #pragma once, it is not an issue for this project.

FunMiles avatar Jun 25 '22 13:06 FunMiles

I left it in as it was auto generated by my IDE. I'll look into it in a couple of days

Harbys avatar Jun 25 '22 21:06 Harbys

My IDE used to generate only the #ifndef version. I modified its template to only generate #pragma once. You might consider doing likewise.

FunMiles avatar Jun 27 '22 01:06 FunMiles

Ok, so this was fixed a while back with no issues.

Harbys avatar Apr 24 '23 15:04 Harbys