Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Extra libraries, Code snippets, applications etc. » C++ language problems and code snippets » Make THISFN simpler and more powerful (by taking advantage of some new c++ feature)
Re: Make THISFN simpler and more powerful [message #60924 is a reply to message #60923] Tue, 08 October 2024 19:25 Go to previous messageGo to previous message
Didier is currently offline  Didier
Messages: 732
Registered: November 2008
Location: France
Contributor
Hello Lance,

What compilers do with bit field is not covered by a standard and is implementation defined... so they do just about whatever they want.
BUT, something important is missing in you're code ! If you really want everything to be side by side, bit wise, you have to specify PACKED option on you're structs
search the web :
__attribute__((packed, aligned(X))) 
or
__PACKED__

This will force the compiler to 'pack' all the bits together not waisting anything : so you will have a stable size.

Note : positionning of the inside the struct is implementation defined ... so some compilers put them in on order, and others the other way around Wink
==> you're code won't be very portable
 
Read Message icon10.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Math - GaussJordan function
Next Topic: Clang cannot find DLLs
Goto Forum:
  


Current Time: Tue Jul 01 09:45:39 CEST 2025

Total time taken to generate the page: 0.04621 seconds