?
=?ISO-8859-1?Q?Sacha_Sch=E4r?=
Hi there,
i have a sequence like the following:
const char *a = "foo";
char b[10];
for ( i = 1; i < strlen(a); i++)
{
b = a;
}
b[0] = a[0];
I guess, an optimizing compiler might mixup the execution order of this
code snipped. How can I enforce, that the copying of the char at
position 0 is done after the loop?
I work in a multithreaded environment, and Semaphores, Mutex etc. are
not suitable for the current situation.
-Sacha
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
i have a sequence like the following:
const char *a = "foo";
char b[10];
for ( i = 1; i < strlen(a); i++)
{
b = a;
}
b[0] = a[0];
I guess, an optimizing compiler might mixup the execution order of this
code snipped. How can I enforce, that the copying of the char at
position 0 is done after the loop?
I work in a multithreaded environment, and Semaphores, Mutex etc. are
not suitable for the current situation.
-Sacha
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]