Jan 5, 2011 at 11:50am UTC
is a PhP languange
What's the equivalent in C++
Jan 5, 2011 at 12:35pm UTC
well... considering i don't know PhP i have no idea from your question. Maybe if you told us what it does?
Jan 5, 2011 at 2:47pm UTC
Looks like an inclusion guard.
In C++ add to the top of your headers:
#ifndef HEADERNAME_H
#define HEADERNAME_H
and on the last line of the header:
#endif
Jan 6, 2011 at 7:03am UTC
Hmm... I am trying to find a way around it actually. No way isn't it :)
That seems to be pretty messy. Why can't there be a macro #includeonce is beyond me.
Jan 10, 2011 at 12:59pm UTC
Visual C++ has
#pragma once
Not all implementation support that
Bravo microsoft!
Jan 11, 2011 at 6:03pm UTC
Then in some other file someone in your team does the same again in a different file:
1 2 3 4
#ifndef F00EY_HPP
#define F00EY_HPP
#include "fooey.h"
#endif
and it breaks your build. 2 days later, you find it has 0 instead of O.
Last edited on Jan 11, 2011 at 6:05pm UTC