how can i tell embedded visual c++ not to produce strh, str, ldrh and ldr instruction, never ever in any part of my code this will solve the alignment exception very easily. i don't mind about the performance of my program. i prefer it to be reliable. i don't need MS to decide for me! i need an option not to use benefits of technology! i need an option to tell the compiler not to produce these instructions. how can i do that

850428 - strh instruction
Proram
a very good sample code u gave, thx
and about what u said, alex, let's don't make things more complicated than what they really are! when the writer may use some words exactly in place of others, like "horrible" in place of "awful", it must be an option for the reader not to encounter this word in the book because of any reason like a horrible background it may have about this word. i didn't mean to omit such an essential word! using "the" is inevitable. i just need the compiler not to decide for me in using ldr, ldrh, str and strh when it may use ldrb and strb in place of them.
when u write a code including a packed struct with a char following with an __int64 member the compiler generates 8 ldrb's when u access the second member as far as it "sees" that it's the member of this struct. so it must not be a weird expectation that the compiler do the same in all cases with responsibility of the programmer himself/herself in not having the same performance.
how can i ask developers of the embedded visual C++ read this text
thx
Daniel_Bowen
Jason Holding
I'm not sure how do you imagine your code compiled without the use of LDR, but even if you do, you are out of luck. Compiler is not *that* flexible. Besides wouldn't it be kind of like asking a writer to produce a novel without the word "the" explaining it by your personal dislike of the word.
What is the alingment exception you are referring to
eslam nader
Manash
char foo[4] = {1, 0, 0, 0};
int* bar = foo;
*bar++; // exception if memory location of foo isn't evenly divisible by 4
He wants the compiler to load ints as multiple bytes, instead of just wrapping an #ifdef around it and doing it manually.
char foo[4] = {1, 0, 0, 0};
#if defined (ARM)
int baz = foo[0] | (foo[1] << 8) | (foo[2] << 16) | (foo[3] << 24);
int* bar = &baz;
#else
int* bar = foo;
#endif
*bar++;
Of course, the MS compiler doesn't properly pack to the byte even when you set packing to 1 byte anyway, but that's a completely different gripe.