Anton, Removing the alignment setting would make the implementation incompatible with the HPI specification. The data structures are passed in raw form between the user application program and the HPI library - which is the interface that SaHpi.h is actually specifying.
Regards, David McKinley > -----Original Message----- > From: Anton Pak [mailto:[email protected]] > Sent: Saturday, July 14, 2012 5:32 PM > To: OpenHPI-devel > Subject: [Openhpi-devel] Integer/float types in SaHpi.h > > Hello! > > While looking into the question about 32/64-bit Client/Server mixing > from Mike Helles, I've realized that integer types defined in SaHpi.h > header are not really cross-platform. > > Currently we have there: > ======================================================================= > == > /* unsigned 8-bit data, 1-byte alignment */ > typedef unsigned char SaHpiUint8T; > > /* unsigned 16-bit data, 2-byte alignment */ typedef unsigned short > SaHpiUint16T; > > /* unsigned 32-bit data, 4-byte alignment */ typedef unsigned int > SaHpiUint32T; > > /* unsigned 64-bit data, 8-byte alignment */ typedef unsigned long > long int SaHpiUint64T __attribute__((__aligned__(8))); > > /* signed 8-bit data, 1-byte alignment */ > typedef signed char SaHpiInt8T; > > /* signed 16-bit data, 2-byte alignment */ > typedef signed short SaHpiInt16T; > > /* signed 32-bit data, 4-byte alignment */ > typedef signed int SaHpiInt32T; > > /* signed 64-bit data, 8-byte alignment */ > typedef signed long long int SaHpiInt64T > __attribute__((__aligned__(8))); > > /* 64-bit floating point, 8-byte alignment */ typedef double > SaHpiFloat64T __attribute__((__aligned__(8))); > ======================================================================= > == > > For most platforms char, short, int and long long give us 8, 16, 32 and > 64 bit types. > However it is not true for all platforms. > > There is standard C99 stdint.h header file that defines integer types > of specified bit size. > Unfortunately Microsoft C compiler is still not C99 compliant and does > not provide stdint.h. > > Also it is not clear why we need alignment for 64 bit types. > The data structures are always go through marshalling layer and never > passed in raw form between client and server. > > My suggestions are: > > - Make use of int8_t, uint8_t, int16_t, uint16_t... types from C99 > stdint.h. > - For Windows make of use of: > -- Way A) __int8t, unsigned __int8_t... types. > -- Way B) stdint.h replacements (some projects provide them, for > example > pstdint.h) > - Remove alignment setting > > What say? > > Anton Pak > > ----------------------------------------------------------------------- > ------- > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. > Discussions will include endpoint security, mobile security and the > latest in malware threats. > http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Openhpi-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/openhpi-devel ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Openhpi-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openhpi-devel
