No spam said:
Well, let me rephrase.
What is the difference between const int foo and static const int foo
as far as the C standard is concerned?
Within a function, adding "static" gives `foo' static lifetime,
i.e. its value persists across the lifetime of the program.
Outside a function, adding "static" gives `foo' internal linkage,
i.e. it is not accessible by name from other translation units.
In either case, you'd better give `foo' an initializer if you
want it to be useful.
As for implementation dependency, which I hope I dont get flamed for,
the addition of the "static" puts the variable in ram when just a
"const" would put the variable in read-only memory on a
compiler/linker used in embedded applications. (assuming default
linker and compiler options).
That's possible, but I don't see why a compiler would do that.
String literals are effectively[1] `static const', and many
implementations do put them into read-only storage.
[1] They are not `const'-qualified, but they are non-modifiable.