B
Blue Ocean
I know this is somewhat dependent on the circumstances, but let me ask
anyway. Suppose I have a 100 byte struct or array or something like
that. Which would be more efficient?
void function(struct something foo)
{
foo.this + foo.that;
foo.somethingoranother++;
printf(foo.foostring);
//other operations on the array
}
or
void function(string something *foo)
{
foo->this + foo->that;
foo->somethingoranother++;
printf(foo->foostring);
//other operations on the array
}
I guess the question I'm trying to ask is, how efficient is it to pass
mostly pointers except for primitive types? Is it a better idea to do
that or to pass by value for the most part?
anyway. Suppose I have a 100 byte struct or array or something like
that. Which would be more efficient?
void function(struct something foo)
{
foo.this + foo.that;
foo.somethingoranother++;
printf(foo.foostring);
//other operations on the array
}
or
void function(string something *foo)
{
foo->this + foo->that;
foo->somethingoranother++;
printf(foo->foostring);
//other operations on the array
}
I guess the question I'm trying to ask is, how efficient is it to pass
mostly pointers except for primitive types? Is it a better idea to do
that or to pass by value for the most part?