Re: Control initialised data layout?
Re: Control initialised data layout?
- Subject: Re: Control initialised data layout?
- From: Greg Guerin <email@hidden>
- Date: Mon, 30 Jul 2007 10:07:07 -0700
Martin Crane wrote:
>static unsigned char gBuffer1[8] = { 'a', 'b', 'c', 'd', 'e', 'f',
>'g', 'h'};
>unsigned char gBuffer2[8] = { 'h', 'g', 'f', 'e', 'd', 'c', 'b', 'a'};
How about defining it as a struct, whose layout you can control. A struct
is what should have been done in the first place.
typedef struct gbuff
{ unsigned char buf1[8]; unsigned char buf2[8]; }
gbuff;
static gbuff gBuffer12 = {
{ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'},
{ 'h', 'g', 'f', 'e', 'd', 'c', 'b', 'a'} };
Refer to gBuffer1 as:
gBuffer12.buf1
You can #define substitutions, too:
#define gBuffer1 (gBuffer12.buf1)
#define gBuffer1 (gBuffer12.buf2)
to reduce the amount of changes needed to source that refers to it.
I'm assuming the external scanner app is not using the symbol-names
gBuffer1 or gBuffer2. If it were, that'd be a problem, although it may be
more readily solvable than the layout one.
(All code typed in mail, not compiled or tested.)
-- GG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden