3 ms·
Plus, at -O1 and up, gcc optimizes this away, so the check itself is not well-defined as necessary. Does it always make sense to strictly enforce code that wil
by PennRobotics 2y ago
Plus, at -O1 and up, gcc optimizes this away, so the check itself is not well-defined as necessary.
Does it always make sense to strictly enforce code that will be optimized/changed during compilation? Or does Xr0 run after compilation/linking?
How to handle things like unions where you want data in a nice mixed-type struct that is used locally and can also be sent as a stream of uint8_t over a wireless connection? Then, the last function that needs to use the memory frees it. Or is that still fine as long as you malloc once somewhere, free once somewhere, and annotate that the memory region will be accessed as more than one dereferenced type?
Much more important: Will the proposed changes be understandable enough for your average CS undergrad to learn in four months of halfway diligent study? (Then again, you might do away with students taking time to debug improper malloc/free and whatever else falls under the scope of Xr0...)
- gpderetta 2y agothe if(0) was just to minimize the test case. if(variable) also fails. This doesn't need to be perfect though. Just incrementally better than the status quo.