On 12/16/2014 4:32 PM, Peter Huewe wrote: > Not sure however if I think to reuse tpm2_startup_in also for shutdown, > simply because it has the same size, but ok.
As I look at marshaling and unmarshaling code, it's tempting to "optimize" by combining structures, using macros, etc. IMHO: The down side is that you make the code harder to read, harder to maintain, and therefore more prone to bugs. The up side is ... nothing really. Combining structures in headers doesn't same any space. And, if you look at the assembler output you'll find that optimizing compilers do a far better job than you will ever do. Saving 10 lines of header by combining the startup and shutdown structures, and then adding 50 lines of comments explaining why it works (and how to fix it if the structure changes), and commenting every place where it appears that the code is wrong but really isn't is a bad trade off. Go for clear, easy to read code and let the optimizing compiler do it's job. ------------------------------------------------------------------------------ Dive into the World of Parallel Programming! The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net _______________________________________________ TrouSerS-tech mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/trousers-tech
