[Interest] Creating a QVariant of QList<QObject*> knowing only the class name

Thiago Macieira thiago.macieira at intel.com
Thu Feb 23 08:58:29 CET 2017


On quarta-feira, 22 de fevereiro de 2017 15:26:09 PST Ch'Gans wrote:
> On 23 February 2017 at 05:42, Thiago Macieira <thiago.macieira at intel.com> 
wrote:
> > On quarta-feira, 22 de fevereiro de 2017 02:40:37 PST Ch'Gans wrote:
> [...]
> 
> >> Tanks for all your inputs, but I'm still puzzled, I can't believe this
> >> is not achievable in a generic way...
> > 
> > It is achievable. I'm saying that the Qt metatype system doesn't do what
> > you want and that the way you tried was UB.
> 
> May I ask what UB stands for? There seems to be zillion of definitions for
> "UB".

The one I used previously in the same email:

"But there's a difference between magic and undefined behaviour."

UB is a technical term that the C and C++ language specifications use to 
specifically say that the behaviour for a given operation is left completely 
undefined by the standard. Since it's undefined per the standard, the standard 
simply stops for your program after that point and it's impossible to predict 
what it will do next.

For example:

	int x = abs(getValue1()), 
	    y = abs(getValue2());
	if (x * y < x)
		throw overflowError();

According to the standard, the exception above can never be thrown.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list