06-11-2006, 07:45 AM
A function can return only types of size 1, 2, 4, 8, 16. To return an user-defined type, use reference argument.
This function returns copy of JobSystem.JobArray[iLoop]:
Calling:
----
This function returns address of JobSystem.JobArray[iLoop]:
Calling:
Of course, you could not return pointer to local variable.
This function returns copy of JobSystem.JobArray[iLoop]:
function int'iJobNr tJobArrayElement&retVal
int iLoop
for iLoop 0 JobSystem.JobArray.len
,if(iJobNr = JobSystem.JobArray[iLoop].nr)
,,break
;;;end-for
retVal=JobSystem.JobArray[iLoop]Calling:
tJobArrayElement je
Func(1 je)
;;;now, manipulating je does not affect JobSystem.JobArray[iLoop]
----
This function returns address of JobSystem.JobArray[iLoop]:
function'tJobArrayElement* int'iJobNr
int iLoop
for iLoop 0 JobSystem.JobArray.len
,if(iJobNr = JobSystem.JobArray[iLoop].nr)
,,break
;;;end-for
ret &JobSystem.JobArray[iLoop]Calling:
tJobArrayElement& r=Func(1)
;now, when you manipulate r, you actually manipulate JobSystem.JobArray[iLoop]
Of course, you could not return pointer to local variable.
