[Development] Using #pragma once

Sérgio Martins sergio.martins at kdab.com
Sun Oct 7 17:41:05 CEST 2018


On 2018-10-07 09:56, Lars Knoll wrote:

> IMO #pragma once is both safer and nicer to use than classic header 
> guards.

Regarding safety, clang has -Wheader-guard which catches typos in header 
guards, so most of our codebase should be ok.
(Would be nice to have clang-cl -Werror builds on our Windows CI 
though!)

Inspired by this I quickly hacked a clazy check to find typos in all 
ifndef/define pairs, since clang only does it for include guards.
It found this https://codereview.qt-project.org/#/c/242090/


Regards,
-- 
Sérgio Martins | sergio.martins at kdab.com | Senior Software Engineer
Klarälvdalens Datakonsult AB, a KDAB Group company
Tel: Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322)
KDAB - The Qt, C++ and OpenGL Experts



More information about the Development mailing list