Bug 83975 - Templates use reserved names as include guards
Summary: Templates use reserved names as include guards
Status: RESOLVED INTENTIONAL
Alias: None
Product: kdevplatform
Classification: Developer tools
Component: appwizard (show other bugs)
Version: 1.0.0
Platform: Compiled Sources Linux
: VLO minor
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-06-25 10:39 UTC by Christoph Bartoschek
Modified: 2009-01-22 23:38 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Bartoschek 2004-06-25 10:39:39 UTC
Version:            (using KDE KDE 3.2.3)
Installed from:    Compiled From Sources

Several c++ application templates use reserved macro names as include guards.

kdevelop/languages/cpp/app_templates/kbearimportfilter/plugin.h
uses for example

#define __KBEAR_%{APPNAMEUC}_IMPORT_FILTER_H__

Macros starting with a underscore are reserved to the implementation. More information can be found in the c++ standard ยง17.4.3.1.2.
Comment 1 Amilcar do Carmo Lucas 2004-06-25 22:22:50 UTC
Feel free to provide a patch
Comment 2 Sascha Cunz 2005-10-20 22:33:47 UTC
Is there actually a compiler where this causes a problem?
Comment 3 Christoph Bartoschek 2005-10-21 09:11:54 UTC
There is no compiler that checks this rule and I guess there will never be one. 

But this rule might prevent some headaches in the future when the compiler vendor chooses a name used in the program. For example our internal list implementation used _LIST_H as include guard. This worked until we upgraded to a newer GCC version.

However one can be sure that the compiler vendor never chooses a name without a leading underscore.
Comment 4 Sascha Cunz 2005-10-21 09:43:28 UTC
Thanks for the reply. However, i think this will stay for quite a while - as all the templates would have to be fixed. But i'll definitive add this to my personal todo list as
 a) Change all CPP/C tempaltes
 b) Include this information in the next "Tutorial for Template-Developers"
Comment 5 Andreas Pakulat 2008-07-05 22:04:28 UTC
not going to happen for kdev3 and kdev4 templates don't use __ include guards.