Review Request: New KDE Macro for to wrap the noreturn attribute

Tomaz Canabrava tcanabrava at kde.org
Mon Feb 13 11:47:49 GMT 2012


On Mon, Feb 13, 2012 at 3:30 AM, David Faure <faure at kde.org> wrote:

>    This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/103832/
>
> Out of curiosity, if the method returns void anyway, why is this attribute necessary? It's not like the the compiler is going to warn about the lack of a return value...
>
>
>
Noreturn is not a return void.  noreturn tells the compiler that the
program will stop right there, killing the app.
The noreturn keyword tells the compiler to assume that the function/method
cannot return. It can then optimize without regard to what would happen if
it ever did return. This makes slightly better code. More importantly, it
helps avoid spurious warnings of uninitialized variables.

Tomaz

- David

>
> On January 31st, 2012, 8:58 p.m., Allen Winter wrote:
>   Review request for kdelibs.
> By Allen Winter.
>
> *Updated Jan. 31, 2012, 8:58 p.m.*
> Description
>
> This diff adds a new macro KDE_NO_RETURN that wraps the noreturn attribute which is enabled differently based on the compiler.
>
>   Testing
>
> did a test compile
>
>   Diffs
>
>    - kdemacros.h.cmake (b93242c)
>
> View Diff <http://git.reviewboard.kde.org/r/103832/diff/>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20120213/a46aa978/attachment.htm>


More information about the kde-core-devel mailing list