J
jyu.james
Is there an easy way to specify that global variables be initialized to
something else besides zero?
Specifically, I have a project that has many global variables spread
across many files. I want all these variables to be initialized to a
pattern of 0xFB. For example, for a 2 byte int, I want the value to be
0xFBFB, and for a 1 byte char, 0xFB, and 3 bytes, 0xFBFBFB.
I suppose I could pack all the variables into a struct and simply
memset it, but this would involve a humongous change in the
organization of the code. Is there a clever way to do this easily
without making such huge changes?
something else besides zero?
Specifically, I have a project that has many global variables spread
across many files. I want all these variables to be initialized to a
pattern of 0xFB. For example, for a 2 byte int, I want the value to be
0xFBFB, and for a 1 byte char, 0xFB, and 3 bytes, 0xFBFBFB.
I suppose I could pack all the variables into a struct and simply
memset it, but this would involve a humongous change in the
organization of the code. Is there a clever way to do this easily
without making such huge changes?