GOOF Design : Output parameters

bibiteinfo

04-02-2007 14:34:32

When I wanted to retreive objects in a partition, I've got my mind mistaken by thinking that in this line : void CorePartition::enumerateObjects(vector<CoreGameObject*>& objects), objects was an input parameter for the function, for a function like this one, shouldn't it be better to return the object list by the return parameter or at least put an out_objects instead of just objects so it get more cleaner to know what's in and what's out in the parameter?

Falagard

06-02-2007 02:36:30

Enumerate functions always work the same way in GOOF, as a by reference array that gets objects added to them. Naming this array outObjects is a decent idea, but the most important thing is the documentation and comments of the function. It won't be a return parameter as that is different functionality altogether.