MESSAGE
DATE | 2016-12-06 |
FROM | Ruben Safir
|
SUBJECT | Re: [Hangout-NYLXS] [png-mng-implement] 4 byte length storage
|
On Tue, Dec 06, 2016 at 07:04:46PM +0100, Andreas Kleinert wrote: > In theory (and future, or past) much might (have) be(en) possible. Probably it is a science on its own to become 100% rocksolid under any possible potential circumstances, and to test & prove that. However such specific env. conditions just might easily break other more sophisticated code parts of the same library elsewhere. Thus if sizeof(uint32_t) does not equal 4 I would consider this a good reason to stop compiling ;-) > > Von meinem iPhone gesendet
I suppose that is what autoconf is for. I don't otherwise know how to say, give me a single variable worth 4 bytes or 8 bits
> > > Am 06.12.2016 um 18:32 schrieb John Bowler : > > > > On Tue, Dec 6, 2016 at 8:55 AM, Andreas Kleinert > > wrote: > >> I have not really checked your code in detail, but are you sure it is not just big vs. little endian conversion...?! > > > > That's why '13' (0x0000000D) appears as 218103808 (0x0D000000), but > > there are other issues in the code that are perhaps best covered by an > > online tutorial such as this one: > > > > https://isocpp.org/wiki/faq/serialization > > > > (That's C++ specific). > > > > One issue is that the code relies on uint32_t being a four byte > > quantity, CHUNK is a typedef of uint32_t: > > > > char * cur = get_index(); > > CHUNK * tmp = reinterpret_cast(cur); > > > > Certainly uint32_t is required to have exactly 32 bits and therefore > > behave as a 32-bit value for modular arithmetic (per the ANSI C spec), > > however I don't know that the representation is constrained to be 4 > > bytes. I would be surprised if C89 (which formalized the type) had > > done that and so far as I can see the above code has undefined > > behavior. > > > > The general rule for serialization is to either use well-defined > > primitives or to do it yourself; the code is not exactly difficult to > > write, though it can be difficult to get right sometimes ;-) > > > > John Bowler > > > > ------------------------------------------------------------------------------ > > Developer Access Program for Intel Xeon Phi Processors > > Access to Intel Xeon Phi processor-based developer platforms. > > With one year of Intel Parallel Studio XE. > > Training and support from Colfax. > > Order your platform today.http://sdm.link/xeonphi > > _______________________________________________ > > png-mng-implement mailing list > > png-mng-implement-at-lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/png-mng-implement > > > ------------------------------------------------------------------------------ > Developer Access Program for Intel Xeon Phi Processors > Access to Intel Xeon Phi processor-based developer platforms. > With one year of Intel Parallel Studio XE. > Training and support from Colfax. > Order your platform today.http://sdm.link/xeonphi > _______________________________________________ > png-mng-implement mailing list > png-mng-implement-at-lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/png-mng-implement
-- So many immigrant groups have swept through our town that Brooklyn, like Atlantis, reaches mythological proportions in the mind of the world - RI Safir 1998 http://www.mrbrklyn.com
DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002 http://www.nylxs.com - Leadership Development in Free Software http://www2.mrbrklyn.com/resources - Unpublished Archive http://www.coinhangout.com - coins! http://www.brooklyn-living.com
Being so tracked is for FARM ANIMALS and and extermination camps, but incompatible with living as a free human being. -RI Safir 2013
------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today.http://sdm.link/xeonphi _______________________________________________ png-mng-implement mailing list png-mng-implement-at-lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/png-mng-implement _______________________________________________ hangout mailing list hangout-at-nylxs.com http://www.nylxs.com/
|
|