Skip to main content
added 8 characters in body
Source Link
Majenko
  • 105.9k
  • 5
  • 82
  • 139

const char trigs[] is an auto - it's allocated on the stack at function entry time - and must be initialized at each invocation. The literal used to do that is stored in globals space, which is why the globals allocation doesn't change.

static const char trigs[] is allocated in globals space and used in place. The symbols' scope is still local, though, so trigs[] isn't visible outside the function.

So why does code space increase by 52 bytes? That seems a lot for copying a string from place to another. So I'll take a guess that the need to copy a string loads a library module that includes it and a few other functions as well.

const char trigs[] is an auto - it's allocated on the stack at function entry time - and must be initialized at each invocation. The literal used to do that is stored in globals space, which is why the globals allocation doesn't change.

static const char trigs[] is allocated in globals space and used in place. The symbols' scope is still local, though, so trigs[] isn't visible the function.

So why does code space increase by 52 bytes? That seems a lot for copying a string from place to another. So I'll take a guess that the need to copy a string loads a library module that includes it and a few other functions as well.

const char trigs[] is an auto - it's allocated on the stack at function entry time - and must be initialized at each invocation. The literal used to do that is stored in globals space, which is why the globals allocation doesn't change.

static const char trigs[] is allocated in globals space and used in place. The symbols' scope is still local, though, so trigs[] isn't visible outside the function.

So why does code space increase by 52 bytes? That seems a lot for copying a string from place to another. So I'll take a guess that the need to copy a string loads a library module that includes it and a few other functions as well.

Source Link
JRobert
  • 15.4k
  • 3
  • 25
  • 53

const char trigs[] is an auto - it's allocated on the stack at function entry time - and must be initialized at each invocation. The literal used to do that is stored in globals space, which is why the globals allocation doesn't change.

static const char trigs[] is allocated in globals space and used in place. The symbols' scope is still local, though, so trigs[] isn't visible the function.

So why does code space increase by 52 bytes? That seems a lot for copying a string from place to another. So I'll take a guess that the need to copy a string loads a library module that includes it and a few other functions as well.