why it is so..
-
why in mfc programming # prgma once is used??
-
why in mfc programming # prgma once is used??
To avoid multiple inclusion of the same header file. This used to be like this:
#ifndef MY_HEADER_FILE_H__
#define MY_HEADER_FILE_H__...
#endif
But using
pragma once
makes it easier.> The problem with computers is that they do what you tell them to do and not what you want them to do. <
-
why in mfc programming # prgma once is used??
Pragma once is used to include the header file only one time when compiling. No sense in having to parse through the same header file multiple times.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
-
To avoid multiple inclusion of the same header file. This used to be like this:
#ifndef MY_HEADER_FILE_H__
#define MY_HEADER_FILE_H__...
#endif
But using
pragma once
makes it easier.> The problem with computers is that they do what you tell them to do and not what you want them to do. <
Code-o-mat wrote:
But using pragma once makes it easier.
but not portable, it's a Microsoft specific pragma (as far as I know).
-
Code-o-mat wrote:
But using pragma once makes it easier.
but not portable, it's a Microsoft specific pragma (as far as I know).
As far as i know you are right.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
-
Code-o-mat wrote:
But using pragma once makes it easier.
but not portable, it's a Microsoft specific pragma (as far as I know).
Recent versions of GNU compiler also support it.
-
why in mfc programming # prgma once is used??
Bisua wrote:
# prgma once
To irritate the compiler.
#pragma once
is notMFC
specific and is even documented :rolleyes: [^]. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Code-o-mat wrote:
But using pragma once makes it easier.
but not portable, it's a Microsoft specific pragma (as far as I know).
-
Code-o-mat wrote:
But using pragma once makes it easier.
but not portable, it's a Microsoft specific pragma (as far as I know).
so are MFC, so it doesn't matter in this case :)
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
Pragma once is used to include the header file only one time when compiling. No sense in having to parse through the same header file multiple times.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
...not to mention the nice "redeclaration" and "multiple definition" errors you'd get.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
-
...not to mention the nice "redeclaration" and "multiple definition" errors you'd get.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
Code-o-mat wrote:
...not to mention the nice "redeclaration" and "multiple definition" errors you'd get.
or even recursive inclusion ;)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]