Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign

redundant header guard in token.h

(1/3) > >>

ollydbg:
In the new svn 5621, there are *two* header guards in token.h. :D


--- Code: ---#ifndef HEADER_799C3ACA6BDBCBC9
#define HEADER_799C3ACA6BDBCBC9

/*
 * This file is part of the Code::Blocks IDE and licensed under the GNU General Public License, version 3
 * http://www.gnu.org/licenses/gpl-3.0.html
 */

#ifndef TOKEN_H
#define TOKEN_H
--- End code ---

Any comments?

MortenMacFly:

--- Quote from: ollydbg on June 06, 2009, 02:45:00 am ---In the new svn 5621, there are *two* header guards in token.h. :D

--- End quote ---
I realised that, too. Will be "fixed" in a future commit (although it doesn't hurt). Thomas' auto-header plugin does not take comments at the beginning of a file into account.

thomas:
...which is the correct thing to do. Said include guard is not the problem, but the comment line is.

Although gcc incidentially does remove comments before doing include guard optimisation, it isn't required to do so, and not all compilers do that. For include optimisation to work reliably, the only thing that is allowed to appear before and after the header guards is whitespace.

MortenMacFly:

--- Quote from: thomas on June 06, 2009, 04:31:55 pm ---For include optimisation to work reliably, the only thing that is allowed to appear before and after the header guards is whitespace.

--- End quote ---
While in theory this is true, in practice (as you see) it works with comments on all compiler I know and the plugin does this "mistake" by far too often. I regularly disable it if I am working on 3rd party code.

So still: It would be nice if the plugin did it "wrong" and take comments into consideration. ;-)

rcoll:

--- Quote from: thomas on June 06, 2009, 04:31:55 pm ---Although gcc incidentially does remove comments before doing include guard optimisation, it isn't required to do so, and not all compilers do that. For include optimisation to work reliably, the only thing that is allowed to appear before and after the header guards is whitespace.

--- End quote ---

Sorry for pushing in, since this is not really my area, but according to both the C and C++ standards (all versions), isn't a comment considered "whitespace"?

Ringo

Navigation

[0] Message Index

[#] Next page

Go to full version