as above
edit: also renamed a variable that used Hungarian notation
Differential D4495
minor refactor to use ranged_for, auto and const-ness majcosta on Nov 20 2019, 19:08. Authored by Tags None Subscribers None
Details
as above edit: also renamed a variable that used Hungarian notation
edit: To check for correct behavior, wrote a test that creates empty blk000xx.dat and rev000xx.dat files from 0 to 28, with contiguous and non-contiguous segments, and runs the CleanupBlockRevFiles() function. then, this test will be run with clang's address, memory and undefined sanitizers, in turn.
Diff Detail
Event Timeline
Comment Actions I fell like you are a bit overdoing it with auto here. I'm not against auto in general, but C++ is a bit trigger happy with copies and implicit conversions. You also want to run this through UBSAN to make sure you are not keeping a reference to a temporary as part of your test plan.
Comment Actions I have run the test using const auto &fileName and it did set off the -fsanitize=address giving me a stack-use-after-scope error, so I went back to by-value semantics. address,undefined and memory sanitizer reported no problems after that (except for one use-of-uninitialized-value on Boost) about all that auto, I compiled my test in a local compiler explorer instance, side by side, using auto in one snippet and fully spelled out types on everything in the other, and the resulting assembly was exactly the same for both g++ and clang, would that be ok then? |