Created
November 30, 2021 16:52
-
-
Save earlephilhower/60a11311c7c86445cfcd28ef38a31c52 to your computer and use it in GitHub Desktop.
GCC assembly output
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <Arduino.h> | |
| void addresses(const char* const begin, const char* const end) { | |
| ::printf("%p:%p -> (%u)\n", begin, end, end - begin); | |
| } | |
| #if 0 | |
| template <size_t Size> | |
| void addresses(const char (&buf)[Size]) { | |
| addresses(std::begin(buf), std::end(buf)); | |
| } | |
| #elif 1 | |
| #define addresses(X)\ | |
| addresses(&X[0], &X[sizeof(X)]) | |
| #else | |
| template <size_t Size> | |
| void addresses(const char (&buf)[Size]) { | |
| addresses(&buf[0], &buf[Size]); | |
| } | |
| #endif | |
| #if 0 | |
| #define EMPTY_STRING "" | |
| #define COMMA_STRING "," | |
| #else | |
| static const char EMPTY_STRING[] = ""; | |
| static const char COMMA_STRING[] = ","; | |
| #endif | |
| void test() { | |
| addresses(EMPTY_STRING); | |
| addresses(COMMA_STRING); | |
| } | |
| void setup() { | |
| Serial.begin(115200); | |
| delay(1000); | |
| ::puts("\n\n\n"); | |
| test(); | |
| } | |
| void loop() { | |
| delay(100); | |
| } |
Author
earlephilhower
commented
Nov 30, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment