Re: return a QVariantList
No, it's OK, because here obj is being returned by value(i.e. a copy of obj will be created and then returned).
You shouldn't do this only if value is returned by reference, for example:
Code:
QVariantList &app::f ()
{
QVariantList obj;
///WRONG!
return obj;
}
Re: return a QVariantList
Yes I also think it is ok in general to return QList QMap or any other data type.
I think problematic also next to what you mentioned is if I am supposed to return a pointer from a function and I return
a pointer to a local variable (e.g., int x) that was defined inside the function.