Modifications

Sauter à la navigation Sauter à la recherche
Ligne 22 : Ligne 22 :  
Le type String permet de stocker une chaine de caractère.
 
Le type String permet de stocker une chaine de caractère.
   −
Literal strings are repeat memory offenders. First they take up space in the program image in Flash, then they are copied to SRAM at startup as static variables. This is a horrible waste of SRAM since we will never be writing to them.
+
Les chaines de caractères littérales (''literal strings'') sont des délinquants récidivistes emportant votre précieuse mémoire SRAM. Plus sérieusement ces chaînes de caractères sont de gigantesques consommateurs de SRAM.
 +
 
 +
First they take up space in the program image in Flash, then they are copied to SRAM at startup as static variables. This is a horrible waste of SRAM since we will never be writing to them.
    
Paul Stoffregen of PJRC and Teensyduino fame developed the F() macro as a super-simple solution to this problem. The F() macro tells the compiler to keep your strings in PROGMEM. All you have to do is to enclose the literal string in the F() macro.
 
Paul Stoffregen of PJRC and Teensyduino fame developed the F() macro as a super-simple solution to this problem. The F() macro tells the compiler to keep your strings in PROGMEM. All you have to do is to enclose the literal string in the F() macro.
Ligne 32 : Ligne 34 :  
  <nowiki>Serial.println(F("Sram sram sram sram. Lovely sram! Wonderful sram! Sram sra-a-a-a-a-am sram sra-a-a-a-a-am sram. Lovely sram! Lovely sram! Lovely sram! Lovely sram! Lovely sram! Sram sram sram sram!"));</nowiki>
 
  <nowiki>Serial.println(F("Sram sram sram sram. Lovely sram! Wonderful sram! Sram sra-a-a-a-a-am sram sra-a-a-a-a-am sram. Lovely sram! Lovely sram! Lovely sram! Lovely sram! Lovely sram! Sram sram sram sram!"));</nowiki>
   −
Will save you 180 bytes of wonderful SRAM!  
+
Will save you 180 bytes of wonderful SRAM!
    
== Réservez l'espace de vos Strings ==
 
== Réservez l'espace de vos Strings ==
29 917

modifications

Menu de navigation