Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualParadigm Shifter

Posted 11 July 2013 - 04:14 PM

You can return a struct (by value, i.e. not via a pointer to the struct) which has a float[3] as its only member as well if you really want to return the array. This may copy but the compiler should be able to optimise the copy out.

 

Don't return the address of a global variable, it doesn't scale well (meaning: doesn't scale at all) if you need to call it recursively or on multiple threads.

 

EDIT: I see Alvaro suggested making a Point class, missed that, it's the same as what I suggested using a class instead of a struct.


#2Paradigm Shifter

Posted 11 July 2013 - 04:09 PM

You can return a struct (by value, i.e. not via a pointer to the struct) which has a float[3] as its only member as well if you really want to return the array. This may copy but the compiler should be able to optimise the copy out.

 

Don't return the address of a global variable, it doesn't scale well (meaning: doesn't scale at all) if you need to call it recursively or on multiple threads.


#1Paradigm Shifter

Posted 11 July 2013 - 04:06 PM

You can return a struct which has a float[3] as its only member as well if you really want to return the array.

 

Don't return the address of a global variable, it doesn't scale well (meaning: doesn't scale at all) if you need to call it recursively or on multiple threads.


PARTNERS