On the Photon only, you may want to connect VBAT to GND if you are not using a coin cell battery or supercap to power VBAT.
The difference is what happens when you power up the Photon the first time. Since there was previously no power, the retained memory contents are uninitialized.
If you connect VBAT to GND, when you first power up the Photon the retained memory will be initialized, either to 0 or to a specific value if the variable has an initializer (usually, see below).
Another technique that I prefer is to not rely on the values being initialized at all, but instead including special values (magic bytes) in retained memory. I use 4 bytes (uint32_t). If the magic bytes are not set, I assume the retained memory is not set and initialize it manually.
There are many more examples here, including how to save strings. You can't use a String but you can use a character array.