We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
HelloI try to add some generalization into the C++ project thus I use std::tuple to hold fields.I'm investigating the difference in assembly code between std::get<1>(myClass.myTuple).read() and myClass.myField.read().myField.read() is compiled as:9A02 ldr r2, [r13, #8]E71F b #0x16a0which is obvious and expected.While std::get<1>(myTuple).read() is compiled as:9B82 ldr r3, [r13, #0x208]695B ldr r3, [r3, #0x14]42AB cmp r3, r5D11B bne #0x1a3cF8BD0210 ldrh.w r0, [r13, #0x210]E761 b #0x1792In theory std::get has to be evaluated in compile-time and the result should be similar in both cases.For what reason do we get this additional comparison?9B82 ldr r3, [r13, #0x208]695B ldr r3, [r3, #0x14]42AB cmp r3, r5D11B bne #0x1a3cI cannot find any situation when the code follows this branch.What can I do to simplify this code?Can I change something in my C++ code to get a result equivalent to direct field access (myField.read())?How can I force the compiler not to generate this additional piece of code?Any help is appreciated./Adam