[Interest] QtThread
Bo Thorsen
bthorsen at ics.com
Tue Jan 21 10:43:34 CET 2014
Den 20-01-2014 17:32, Thiago Macieira skrev:
> On segunda-feira, 20 de janeiro de 2014 12:41:33, Bo Thorsen wrote:
>> I have just created a suggestion in the bug tracker to make it illegal
>> to do moveToThread(this):
>>
>> https://bugreports.qt-project.org/browse/QTBUG-36278
>>
>> It can't be said often enough: Don't do this! But if it was illegal
>> behaviour, we wouldn't have to say it.
>
> Because it's not illegal to do it. It's just a bad idea in most cases.
This is true, and I do see the point. If someone can actually point to a
reasonable use case for it. If not, I would still choose to make it illegal.
I have seen moveToThread(this) many times and every single one of them
was wrong. To me this suggests that it might be better to protect new Qt
developers instead of handing them a tool they only use to shoot
themselves in the foot with.
> I'd rather not add a check for things you shouldn't do but that might still
> work nonetheless. That's wasted CPU cycles for people who did the right thing.
This point I won't just take, though. moveToThread is not an operation
that will be used often, so optimization is almost irrelevant. Well, I
certainly hope that noone does moveToThread a lot :)
Anyway, it's not my decision. I'll argue the case because I think it's
the right thing to do, but it's not important to me.
Bo.
--
Bo Thorsen, European Engineering Manager, ICS
Integrated Computer Solutions. Delivering World-Class Applications
http://ics.com/services
More information about the Interest
mailing list