easy yet frustrating variable order problem 
Author Message
 easy yet frustrating variable order problem

Quote:

> I tried rebuilt and recompile program options to no avail. How can I
> force the compiler to generate data in the order I specify? Thanks.

    Short answer: No.  The compiler can put them in any order, and the
linker can put them in different segments if it likes.   Fortunately, C/C++
defines a way to force data to be in contiguous memory.  It's know as an
"array"

    char    data[4];

--
Truth,
James Curran
http://www.*-*-*.com/
http://www.*-*-*.com/



Tue, 17 Sep 2002 03:00:00 GMT  
 easy yet frustrating variable order problem
I have the following global varialbe declarations:
char data_1,
data_2,
data_3;

Checking their address with dissembly window, I see all three variables
are arranged as follows:
data_1, data_2, data_3, which is what one would expect.

Then I add another variable such that:
char data_1,
data_2,
data_4
data_3;
But instead of the expected arrangement of data_1, data_2, data_4,
data_3, the VC actually has data_1, data_2, data_3, data_4, totally
ignoring my explicit data orgnization.

I tried rebuilt and recompile program options to no avail. How can I
force the compiler to generate data in the order I specify? Thanks.

Sent via Deja.com http://www.deja.com/
Before you buy.



Tue, 17 Sep 2002 03:00:00 GMT  
 easy yet frustrating variable order problem
I have the following global varialbe declarations:
char data_1,
data_2,
data_3;
Checking their address with dissembly window, I see all three variables
are arranged as follows:
data_1, data_2, data_3, which is what one would expect.
Then I add another variable such that:
char data_1,
data_2,
data_4
data_3;
But instead of the expected arrangement of data_1, data_2, data_4,
data_3, the VC actually has data_1, data_2, data_3, data_4, totally
ignoring my explicit data orgnization.
I tried rebuilt and recompile program options to no avail. How can I
force the compiler to generate data in the order I specify? Thanks.

Sent via Deja.com http://www.deja.com/
Before you buy.



Tue, 17 Sep 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Load order and DLL entry order of implicitly linked DLLs, Environment variables

2. yet another easy one...

3. High order/low order problem

4. frustrating linking problem

5. strange and frustrating complie problem with TCv2

6. simple but frustrating problem

7. Frustrating Linker Problem

8. Really frustrated by this weird CRichEditCtrl problem.

9. Frustrating Rich Edit control problem

10. Order of initialization, automatic variables

11. Variable declaration order

12. Order of variables matters?

 

 
Powered by phpBB® Forum Software