Having just started out developing for the Pebble app - and also returning to my very basic C skills which has not been maintained for many many years, I am trying to understand the basic structure of these Pebble apps.
I do know the difference between static and nonstatic, but would be very happy if anyone could help shed some light on the impact on my application in this case. I have pasted minimized example code below, which shows how the Pebble app is structured in the two cases.
Static version
#include <pebble.h>
static Window *window;
static void handle_init(void) {
window = window_create();
window_stack_push(window, true);
}
static void handle_deinit(void) {
window_destroy(window);
}
int main(void) {
handle_init();
app_event_loop();
handle_deinit();
}
Non-static version
#include <pebble.h>
Window *window;
void handle_init(void) {
window = window_create();
window_stack_push(window, true);
}
void handle_deinit(void) {
window_destroy(window);
}
int main(void) {
handle_init();
app_event_loop();
handle_deinit();
}
My question is this:
What's the implications of using nonstatic vs static variables and functions?
I have tried to find information on the Pebble developer site, but static and non-static examples seems be be used without much consistency and I have failed to find a good official guideline.