-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Update PROGMEM reference page to recommend "const" #1536
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
Comments
While we're updating the PROGMEM page, perhaps the prog_char etc. stuff can also go? Since avr-gcc 1.8.0, those types are deprecated and it's ok to use the regular types (so just PROGMEM char foo;). The PROGMEM page is now confusing for people. The Arduino itself already stopped using these types over a year ago (see 0acebee). |
It's been 7 months and Starting with #795 , #1695 and #1448 tried to fix this in the source level, Occurances of
while
from the above |
Looking into the avr changes for 1.8 it looks to me that the right replacement for the deprepcated ie, in const prog_char hello_user_script1[] PROGMEM="What's your name?"; should become PGM_P const hello_user_script1 PROGMEM="What's your name?"; I will try to find some time and make the changes, then test the result. |
You're right that PGM_P is the backward-compatible replacement for prog_char *. However, realize that declaring a
declares a four-element array, which is initialized to {'1', '2', '3', '\0'}. In other words, the size of the
causes the string "123" (e.g., four bytes with values {'1', '2', '3', '\0'} to be put into memory somewhere, and the variable Now, I think this means that the line:
will put the two-byte pointer in PROGMEM, but the actual string in regular memory. I haven't this, but this is how I understand how things should work. However, the changelog you linked says:
Which suggests to me that the |
Where is the repository for the Arduino reference pages? I would submit pull requests for documentaton updates, except that the content does not seem to be in this repository. |
@Nantonos we are working on improving the way people may contribute to the documentation. Stay tuned |
Hello Federico, Wednesday, February 18, 2015, 8:43:20 AM, you wrote:
Excellent, great news. With 1.0.x it seemed that the documentation shipped locally and the Best regards, |
Yes, 1.6.0 has an updated snapshot of the documentation. |
Language content. Ok but PROGMEM needs to be modified according to arduino/Arduino#1536
@Nantonos here https://github.com/arduino/reference-en the repo. We are still working on the documentation but you can contribute :) |
Hello Arturo, Friday, February 20, 2015, 10:34:43 AM, you wrote:
Excellent, thanks for the pointer. Best regards, |
@Nantonos reference updated let me know if you have any suggstion or improvement so i can include them both online and in the new repo :) |
Hello Arturo, Friday, February 20, 2015, 1:05:18 PM, you wrote:
Looking on It would also be good to see discussion of how this is an AVR feature http://forum.arduino.cc/index.php?topic=155158.0 and is a known compat issue Would you prefer that I fork this repo and submit pull requests, or discuss Best regards, |
@Nantonos i pushed online a new PROGMEM reference here http://arduino.cc/en/Reference/PROGMEM you can use it as template to improve the documentation. Please if you want to contribute fork the repo and submit a PR! |
ok you can fork it now |
The old AVR toolchain Arduino uses does not require "const" together with PROGMEM, but it accept const. But newer versions do require const.
This old documentation should be updated to recommend coding practice that is forward compatible.
http://arduino.cc/en/Reference/PROGMEM
It might also be good to mention Arduino Due, which doesn't use AVR PROGMEM.
The text was updated successfully, but these errors were encountered: