Andre Poenitz <[EMAIL PROTECTED]> writes: | On Mon, Oct 13, 2003 at 10:00:10AM +0200, Lars Gullik Bjønnes wrote: >> | with FuncResult being >> > >> | struct FuncResult { >> | dispatch_result res; >> | idx_type idx; >> | pos_type pos; >> | }; >> >> Are you sure that no dispatch ever uses the idx and pos passed in? > | Sure they do. Tab in a math array sort of increments the index. > >> | The reason is that we'd most likely have to add a third item soonish to >> | model 'Parlist/Paragraph/Position' of InsetTabular and I do not want to >> | touch all headers again. And it is less clutter... >> >> I have no problem with that, so ask me to do it when the time arises. > | But I have. > | Perhaps bad memories regarding Fortran subroutines taking 37 arguments | and compilers not complaining if only 36 have been passed... > >> I'l continue to do monotonic improvements anyway. >> (The return of FuncResult f.ex., which actually fit rather well with >> my plans for dispatch.) > | I'd pretty much prefer the modifiable reference as the resulting code is | much shorter. > | Compare > | void dispatch(FuncRequest & cmd) | { | ++cmd.idx; | cmd.result = DISPATCHED; | } > > | with > | FuncResult dispatch(FuncRequest const & cmd) | { | FuncResult res; | res.pos = cmd.pos; | res.idx = cmd.idx + 1; | res.result = DISPATCHED; | return res; | }
I actually like the second one a lot better, the first one smells of voodoo. And it would not be a realy problem to havd a FuncResult able to take a FuncRequest as an arg to extract information from it: FuncResult dispatch(FuncRequest const & cmd) { FuncResult res(cmd); ++res.pos; res.result = DISPATCHED; return res; } -- Lgb