Here is a chunk of data
float m_fStrtTime, m_fTRise, m_fT0
float m_fFO20, m_fFO2M, m_fFO2F
float m_fFCO20, m_fFCO2M, m_fFCO2F
float m_fFHeF, m_fFHeFF;
float m_fR2Hel, m_fR2Acet, m_fR2DME, m_fR2CO
float m_fIHel, m_fKHel, m_fIAcet, m_fKAcet, m_fIDME, m_fKDME, m_fICO, m_fKCO
float m_fAcetCardOut, m_fAcetVtis
float m_fAcetCardOut1, m_fAcetVtis1
float m_fAcetWagnCardOut
float m_fDMECardOut, m_fDMEVtis
float m_fDMECardOut1, m_fDMEVtis1
float m_fDMEWagnCardOut
float m_fDCOr, m_fOCDCO, m_fOCDCOVA
float xFGas0[RDI_END_POS+1]
float xFGasLung[RDI_END_POS+1]
float m_fFresp, m_fMeanVT, m_fTotVE
float m_fEELV, m_fVRtot, m_fVDeff, m_fVAeff, m_fVR, m_fVENTeff
float m_fOCVA, m_fOCVSD, m_fOCVSDI
float m_fAcetCOfac
float m_fDMECOfac
double m_daSolnHe[RD_SOLNHE_PARAMS+1]
unsigned m_uLungDataPos
double m_dVO2, m_dVCO2
float m_fDNO, m_fKNO, m_fINO, m_fR2NO
short __gxrcFinData
And here is a little method to get the size of this set of data
size_t sz=(char *)&__gxrcFinData-(char *)&m_fStrtTime;
return sz
In VC++ v6.0, this returns 408 bytes. In VC++.NET, it returns 412 bytes. In debugging some code that reads/writes a binary file with this data chunk in it, I can tell there is no problem up to the array m_daSolnHe. The array size is reported as 32 by both compileres. The size of the unsigned is 4 in both. I can NOT put my finger on the problem here -- does anyone know of a problem with fundamental data types in the more recent compiler version? 6 2943
CaseyB wrote: Here is a chunk of data:
float m_fStrtTime, m_fTRise, m_fT0; float m_fFO20, m_fFO2M, m_fFO2F; float m_fFCO20, m_fFCO2M, m_fFCO2F; float m_fFHeF, m_fFHeFF; float m_fR2Hel, m_fR2Acet, m_fR2DME, m_fR2CO; float m_fIHel, m_fKHel, m_fIAcet, m_fKAcet, m_fIDME, m_fKDME, m_fICO, m_fKCO; float m_fAcetCardOut, m_fAcetVtis; float m_fAcetCardOut1, m_fAcetVtis1; float m_fAcetWagnCardOut; float m_fDMECardOut, m_fDMEVtis; float m_fDMECardOut1, m_fDMEVtis1; float m_fDMEWagnCardOut; float m_fDCOr, m_fOCDCO, m_fOCDCOVA; float xFGas0[RDI_END_POS+1]; float xFGasLung[RDI_END_POS+1]; float m_fFresp, m_fMeanVT, m_fTotVE; float m_fEELV, m_fVRtot, m_fVDeff, m_fVAeff, m_fVR, m_fVENTeff; float m_fOCVA, m_fOCVSD, m_fOCVSDI; float m_fAcetCOfac; float m_fDMECOfac; double m_daSolnHe[RD_SOLNHE_PARAMS+1]; unsigned m_uLungDataPos; double m_dVO2, m_dVCO2; float m_fDNO, m_fKNO, m_fINO, m_fR2NO; short __gxrcFinData;
And here is a little method to get the size of this set of data: size_t sz=(char *)&__gxrcFinData-(char *)&m_fStrtTime; return sz; In VC++ v6.0, this returns 408 bytes. In VC++.NET, it returns 412 bytes. In debugging some code that reads/writes a binary file with this data chunk in it, I can tell there is no problem up to the array m_daSolnHe. The array size is reported as 32 by both compileres. The size of the unsigned is 4 in both. I can NOT put my finger on the problem here -- does anyone know of a problem with fundamental data types in the more recent compiler version?
See #pragma pack
Your problem is not with the size of the members, but with the padding
between them. I'm assuming you have all these members in a struct. If you
don't, you're simply relying on undefined behavior & need to change your
code.
-cd
Hi,
What is the value of RDI_END_POS ?
I guess RD_SOLNHE_PARAMS is 3
Thanks,
Mohamed
"CaseyB" <an*******@discussions.microsoft.com> wrote in message
news:82**********************************@microsof t.com... Here is a chunk of data:
float m_fStrtTime, m_fTRise, m_fT0; float m_fFO20, m_fFO2M, m_fFO2F; float m_fFCO20, m_fFCO2M, m_fFCO2F; float m_fFHeF, m_fFHeFF; float m_fR2Hel, m_fR2Acet, m_fR2DME, m_fR2CO; float m_fIHel, m_fKHel, m_fIAcet, m_fKAcet, m_fIDME, m_fKDME, m_fICO,
m_fKCO; float m_fAcetCardOut, m_fAcetVtis; float m_fAcetCardOut1, m_fAcetVtis1; float m_fAcetWagnCardOut; float m_fDMECardOut, m_fDMEVtis; float m_fDMECardOut1, m_fDMEVtis1; float m_fDMEWagnCardOut; float m_fDCOr, m_fOCDCO, m_fOCDCOVA; float xFGas0[RDI_END_POS+1]; float xFGasLung[RDI_END_POS+1]; float m_fFresp, m_fMeanVT, m_fTotVE; float m_fEELV, m_fVRtot, m_fVDeff, m_fVAeff, m_fVR, m_fVENTeff; float m_fOCVA, m_fOCVSD, m_fOCVSDI; float m_fAcetCOfac; float m_fDMECOfac; double m_daSolnHe[RD_SOLNHE_PARAMS+1]; unsigned m_uLungDataPos; double m_dVO2, m_dVCO2; float m_fDNO, m_fKNO, m_fINO, m_fR2NO; short __gxrcFinData;
And here is a little method to get the size of this set of data: size_t sz=(char *)&__gxrcFinData-(char *)&m_fStrtTime; return sz; In VC++ v6.0, this returns 408 bytes. In VC++.NET, it returns 412 bytes.
In debugging some code that reads/writes a binary file with this data chunk
in it, I can tell there is no problem up to the array m_daSolnHe. The array
size is reported as 32 by both compileres. The size of the unsigned is 4 in
both. I can NOT put my finger on the problem here -- does anyone know of a
problem with fundamental data types in the more recent compiler version?
Wow, this is news -- I have tons of code where i use the same trick, which I could swear i got from a C++ text somewhere, but maybe not. So I guess you are saying that if the vars are not neatly tucked into a struct, there could be gaps in where they get stored in memory. But wait -- these are data members of a class, which I guess I didnt menton in the original message. Does that change things? A class is same as struct in this regard, right?
CaseyB wrote: Wow, this is news -- I have tons of code where i use the same trick, which I could swear i got from a C++ text somewhere, but maybe not. So I guess you are saying that if the vars are not neatly tucked into a struct, there could be gaps in where they get stored in memory. But wait -- these are data members of a class, which I guess I didnt menton in the original message. Does that change things? A class is same as struct in this regard, right?
Yes.
See #pragma pack - that'll take care of your problem.
-cd
Yes, 3 -- I got a nice answer from Carl Daniel....
pragma pack -- thanks for the info... This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Chris Mantoulidis |
last post by:
Out of curiosity, I wanted to test executable file sizes of the same
program from different compilers...
The 2 compilers I tested (both old, on purpose) were Borland C++ 3.1
and DJGPP 2.03...
...
|
by: Esger Abbink |
last post by:
Hello,
it is very possible that this is a well described problem, but I have
not been able to find the solution.
On two production server (7.2rc2) of ours the data directory is growing
to...
|
by: Thomas Paul Diffenbach |
last post by:
Can anyone point me to an open source library of /statically
allocated/ data structures?
I'm writing some code that would benefit from trees, preferably self
balancing, but on an embedded system...
|
by: Randy Howard |
last post by:
Suppose you want to have a large number of items (as an array of struct)
wherein one field is "record-specific" and of variable length, yet not
violate standard C (C90 probably, since C99 isn't...
|
by: Kip |
last post by:
Greetings everyone,
Is there anyone here who could point me to a page or pdf that has a
list of the sizes of all of the C primitive data types on various
implementations such as SPARC, x86,...
|
by: siliconwafer |
last post by:
Who decides size of data types in C?
Is it the:
1.C standard and hence the compilers
2.Operating System.
|
by: Madhu Gopinathan |
last post by:
Hi,
Hope I have got the right news group here. I am migrating my C++ code
from Visual C++ 6.0 to Visual Studio.Net version. I have noticed that the
binaries that are produced are upto 40% bigger...
|
by: ramu |
last post by:
Hi,
I want to call a vc++ function from a c program on linux. So
when I do this dosen't the VC++ datatypes differ with c datatypes.
Because we don't have some vc++ data types in c. I have to...
|
by: rAinDeEr |
last post by:
Hi,
I have a web application with a table to store terms and
conditions of a Company.
This may some times run into many pages and some times it may be just a
few sentences. It is a character...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| | |