Skip to main content
9 events
when toggle format what by license comment
Aug 6, 2024 at 1:04 comment added DannyNiu @Basilevs FYI, I use qemu-user to test my programs on different architectures, I could do the same to generate those sizes and alignments.
Aug 5, 2024 at 17:30 comment added Basilevs Meh, if platforms are mismatched, all bets are off. Also, it is possible to include arch guards in the header.
Aug 5, 2024 at 17:22 comment added Doc Brown @Basilevs: there are 2 builds: the OP's build which creates the user header, and the user's build, maybe on a different platform. The OP's build includes running the generator on the platform they use for their build, which is not necessarily the target platform.
Aug 5, 2024 at 16:32 comment added Basilevs @DocBrown the generator is run as part of the build, so sizes are recomputed for each platform.
Aug 5, 2024 at 16:13 comment added Doc Brown @Basilevs:step 1 requires some generator tool which will be executed on the build platform and reports sizes and alignment on that platform. If the user of the library compiles and runs the code then on a platform with different size and alignment, this may cause issues.
Aug 4, 2024 at 20:01 comment added Basilevs @DocBrown the sizes and offsetas are stored in code. How would hardware affect anything besides alignment?
Aug 3, 2024 at 12:22 comment added Doc Brown I think this will often work, still I guess one has to be careful with this approach when the build process runs on a different hardware than the final program.
Aug 3, 2024 at 9:50 vote accept DannyNiu
Aug 1, 2024 at 13:18 history answered DannyNiu CC BY-SA 4.0