On 02/11/12 12:18, Claudio Valderrama C. wrote: >> -----Original Message----- >> From: Dmitry Yemanov [mailto:[email protected]] >> Sent: Sábado, 11 de Febrero de 2012 2:43 >> >> 11.02.2012 3:19, Adriano dos Santos Fernandes wrote: >> >>> Do not think it must be in bid. They must be static in blb IMO. >> Agreed. > Ok, they are inside blb now. I have a little mess because I made several > data members private, but I was hesitant to reorder them, so I have several > private and public sections. Looking at the supposed order in which the > datatypes were put, it seems we have first the pointers, then the USHORTs, > then the ULONGs and finally the size_t's (there are some exceptions, but > this is the general order). Example: > > private: > Attachment* blb_attachment; // database attachment > .... > USHORT blb_pointers; // Max pointer on a page > .... > public: > USHORT blb_max_segment; // Longest segment > .... > private: > USHORT blb_pg_space_id; // page space > ULONG blb_sequence; // Blob page > sequence > <more ULONGs> > public: > ULONG blb_length; // Total length of > data sans segments > private: > ULONG blb_temp_id; // ID of newly > created blob in transaction > > Maybe this order is only a coincidence and I should merge all the private > parts.
The only aspect from which order of members is important is alignment and memory consumption issue. I.e. if we do something like this: size_t a; short b; size_t c; on 64-bit machine we loose 6 bytes between b and c. The safest from this POV order of fields is approx. following: double, int64, size_t, pointers, int32, short. ON the other hand, inserting too many private/public is also not good, may be splitting the whole list into 2 (public/private) is better. ------------------------------------------------------------------------------ Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2 Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel
