Both C and C++ allow you to return by value aggregates, e.g., structs and unions, from a function. However, the runtime overhead of returning large objects by value can be significant. This is why certain compilers issue a warning message when you return an aggregate from a function. For example:
In most cases, you can avoid this inefficiency by passing a reference to the aggregate as an argument and write the result into that reference:
void current_date(Date & d); // improved form
This is more efficient than passing or returning large objects by value.