> On Jan. 9, 2016, 12:42 a.m., Joris Van Remoortere wrote: > > 3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/dirent.hpp, > > lines 193-199 > > <https://reviews.apache.org/r/39019/diff/10/?file=1175210#file1175210line193> > > > > `free` is meant to be safe for `NULL/nullptr`. > > Why not follow this pattern? > > asserting `directory != NULL` seems like it might surprise people? > > Alex Clemmer wrote: > Well, you are the C++ programmer, so I'll trust your judgement on the > `assert`s here. > > But, since this question about `assert` comes up 3 times in your review, > I'll answer your question, and justify the switch. I initially chose to do it > this way because I think internal APIs are easier to reason about if all the > functions assume the data in non-`_OUT_` params is fully initialized before > you call. I just used `assert` to make this assumption explicit, which I > think is a good way of broadcasting to internal users what the contract is. > > Of course, (1) if you think this is less clear, then my thesis is clearly > wrong, and (2) the actual difference in this case is not really a substantial > amount of code/complexity, so the cost of switching to your model is not > prohibitive, so if I were to advocate staying it would be for purely > religious reasons. > > Therefore, we shall transition to fit your suggestion.
I ended up changing my mind on the other two `assert`s. See below. - Alex ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/39019/#review113576 ----------------------------------------------------------- On Dec. 23, 2015, 6:44 a.m., Alex Clemmer wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/39019/ > ----------------------------------------------------------- > > (Updated Dec. 23, 2015, 6:44 a.m.) > > > Review request for mesos, Alex Naparu, Daniel Pravat, Artem Harutyunyan, > Joris Van Remoortere, and Joseph Wu. > > > Bugs: MESOS-3441 > https://issues.apache.org/jira/browse/MESOS-3441 > > > Repository: mesos > > > Description > ------- > > Windows: Added dirent compat code for non-Unix systems. > > > Diffs > ----- > > 3rdparty/libprocess/3rdparty/stout/include/Makefile.am > b2dea9b93adfa3ea0415a0b5c81a369dd29b6cfe > > 3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/dirent.hpp > PRE-CREATION > 3rdparty/libprocess/3rdparty/stout/include/stout/windows.hpp > d46e262e0fd1c2de36f3bf19d8bd693c23bf58cd > > Diff: https://reviews.apache.org/r/39019/diff/ > > > Testing > ------- > > `make check` from autotools on Ubuntu 15. > `make check` from CMake on OS X 10.10. > Ran `check` project in VS on Windows 10. > > > Thanks, > > Alex Clemmer > >