OFF-TOPIC: Include Guards



I remember reading somewhere (I forget exactly where) that g++ would not include
a header file multiple times if it was completely enclosed by an internal
include guard. An implicit "#pragma once", if you will.

This saves the overhead of opening the file, parsing it, etc.

My question is, is it smart enough to detect this case:

// myheader.h
#ifndef INCLUDED_MYHEADER
#define INCLUDED_MYHEADER
// ...
#endif

I like to place my header comments at the top of the file and want to know if
that defeats g++'s handling of internal include guards. I notice some of the
GNOME headers do the same.

I'd appreciate a quick reply if you know the answer to this.

-- 
SEGV    http://www.cgocable.net/~mlepage/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]