Bug 263913 - KDevelop must create pragma once with include guards
Summary: KDevelop must create pragma once with include guards
Status: RESOLVED INTENTIONAL
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (old) (show other bugs)
Version: unspecified
Platform: unspecified Unspecified
: NOR wishlist
Target Milestone: 4.2.0
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-21 19:44 UTC by Denis Pesotsky
Modified: 2021-12-05 16:55 UTC (History)
1 user (show)

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 Denis Pesotsky 2011-01-21 19:44:55 UTC
Version:           unspecified (using KDE 4.5.5) 
OS:                unspecified

When I create class for C/C++ with Project Manager's "Create Class", it creates header with include guards.

But it will be nice, if it will also add pragma once there.

Reproducible: Didn't try

Steps to Reproduce:
Create Class with project manager.

Actual Results:  
Header will look like:
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

class MainWindow
{

};

#endif // MAINWINDOW_H

Expected Results:  
Will be nice if header will look like:
#pragma once
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

class MainWindow
{

};

#endif // MAINWINDOW_H
Comment 1 Andreas Pakulat 2011-01-21 22:17:25 UTC
Why? Apart from this being _very_ compiler-specific as opposed to the include-guards I don't see a reason for doing both. The compiler that does know pragma's can work just fine with include-guards as well - afaik.
Comment 2 Denis Pesotsky 2011-01-21 22:53:16 UTC
> The compiler that does know pragma's can work just fine with include-guards as well

Did not know that. You mean, that all popular compilers (including gcc, vcc etc) support include guards optimisation if they have pragma once support?
Comment 3 maty78485 2021-12-05 16:55:22 UTC
I would give the user a choice - whether to use `#pragma once` or `#ifndef / #define` include guards.