Il 21/02/20 12:49, Julien Cugnière ha scritto:
Isn't that true of any function call though ? Any function could end
up deleting this, or trigerring code in another thread, or anything.
For example, a normal function call could end up emiting a signal, and
as such, any function could be as dangerous as a signal.

Not really: for functions you call explicitly, you know their preconditions and postconditions. printf is not going to delete this, and malloc is not going to reenter another function of your object while you're mutating the state risking to find garbage.

The big difference with signal emission is that they don't generally impose anything at all (preconditions, implementation, postconditions) on the slots being connected, in the name of loose coupling. As someone reasoning on the code emitting the signal, the annotation that control is leaving and anything can happen at that point is a positive ε of valuable information.

The other problem with emit, is that it's not required. So its absence
doesn't mean a signal is not being emitted.

Sure, but that's why Clazy is angry about emit missing in front of a signal call, or if someone puts emit in front of something that is not a signal.

--
Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts

Attachment: smime.p7s
Description: Firma crittografica S/MIME

_______________________________________________
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to