سؤال

Do you feel it is important to strictly use const every time the value won't be changed or pass arguments as pointers only when the data will be modified?

I'd like to do things right but if a struct passed as an argument is large in size, don't you want to be passing the address instead of copying the data? Usually it seems like just declaring the struct argument as an operand is most functional.

//line1 and line2 unchanged in intersect function
v3f intersect( const line_struct line1, const line_struct line2); 
//"right" method?  Would prefer this:
v3f intersect2( line_struct &line1, line_struct &line2); 

لا يوجد حل صحيح

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top