In pgmspace.h, PROGMEM is outlined as __ATTR_PROGMEM__, which is outlined as __attribute__((__progmem__)). AFAIK, __attribute__ is GNU solely. Since C++ 11, now we have the attribute specifier sequence.

I can not use [[__progmem__]] as an alternative of PROGMEM. The error is

warning: ‘__progmem__’ attribute directive ignored [-Wattributes]

Should not that work equally?

Why would I need to try this?

  1. Readability: After I first learn code that used PROGMEM, I believed that that is the variable identify (being a continuing, now we have a conding guideline that it ought to be higher case, which matched). Studying on, I discovered the actual variable identify, which confused me. Placing it into sq. brackets would instantly have made clear that it is an attribute and never a reputation.
  2. Portability: [[ ]] is Normal C++, whereas __attribute__ is just not.

Possibly I ought to simply learn the whole documentation…

Underneath Normal Attributes, we see the attributes that include the C++ Normal. __progmem__ is not one among them.

Following the instance for syntax 2, I attempted [[gnu::__progmem__]], which compiles. So this helps with Readability, however because it now has the gnu namespace, it would not assist with Portability.

1