Sign in to follow this  
Shashwat Rohilla

Header Files

Recommended Posts

Short story: The angle bracket version is for external header files, the quotation marks are for your own header files. See [url="http://msdn.microsoft.com/en-us/library/36k2cdd4(v=vs.80).aspx"]here[/url] for a full explanation.

[quote]
Please look in the standard!
[/quote]
The standard is no place for an inexperienced programmer.

Share this post


Link to post
Share on other sites
[quote name='rip-off' timestamp='1306409827' post='4815995']
Short story: The angle bracket version is for external header files, the quotation marks are for your own header files. See [url="http://msdn.microsoft.com/en-us/library/36k2cdd4(v=vs.80).aspx"]here[/url] for a full explanation.

[quote]
Please look in the standard!
[/quote]
The standard is no place for an inexperienced programmer.
[/quote]

Incorrect replies like yours have no place at all. The short story is that it is implementation defined where each of these look for files and even that they may look in the same place.

Share this post


Link to post
Share on other sites
[quote name='magic_man' timestamp='1306409653' post='4815994']
Please look in the standard!
[/quote]

Q: "How do I turn on the headlights?"
A: "Please consult Feynman's 4-part works on physics"

Do you own a copy of C++ standard? Not draft, the actual copy.

Share this post


Link to post
Share on other sites
[quote name='Antheus' timestamp='1306410974' post='4816004']
Do you own a copy of C++ standard? Not draft, the actual copy.
[/quote]

Me? Yes thanks, is there a difference between the draft and the final here IIRC the C++ standard uses pretty much the same word for word description as C99.

[quote]
[quote name='magic_man' timestamp='1306409653' post='4815994']
Please look in the standard!
[/quote]

Q: "How do I turn on the headlights?"
A: "Please consult Feynman's 4-part works on physics"
[/quote]
Where are the headlights?



As for
[quote][color=#1C2837][size=2]The standard is no place for an inexperienced programmer. [/quote][/size][/color]
[color=#1C2837][size=2]I consider this wrong but if the user had posted in "For Beginners" then maybe I would have answered differently :)[/size][/color]

Share this post


Link to post
Share on other sites
[quote name='magic_man' timestamp='1306411909' post='4816008']

Me? Yes thanks, is there a difference between the draft and the final here IIRC the C++ standard uses pretty much the same word for word description as C99.[/quote]

No clue. It's completely useless to me, what matters to me is how GCC, LLVM, Intel or MS compilers work.

[quote]Where are the headlights?[/quote]

Please consult the traffic legislation regulating the automobile industry relevant to your jurisdiction.

Share this post


Link to post
Share on other sites
[quote name='magic_man' timestamp='1306410027' post='4815998']
Incorrect replies like yours have no place at all.
[/quote]
I think you'll find my answer holds significantly more value to the OP. For all practical purposes it is correct.

[quote]
[quote]
The standard is no place for an inexperienced programmer.
[/quote]
I consider this wrong but if the user had posted in "For Beginners" then maybe I would have answered differently
[/quote]
Why don't we just close every pure C++ thread - since the correct answers are all in the standard.

Share this post


Link to post
Share on other sites
OK this thread confuses me somewhat. Factually incorrect information gets voted up and factually correct information which asks the [b]lazy[/b] OP to do some leg work themselves gets voted down? With a post about headlights also getting voted up. Erm let me check again is this the Lounge!

[quote] [color="#1C2837"][size="2"]Why don't we just close every pure C++ thread - since the correct answers are all in the standard. [/quote][/size][/color]
[color="#1C2837"][size="2"]That sounds like an excellent idea but what in the OP's post says it is C++?[/size][/color]

Share this post


Link to post
Share on other sites
I see. What gamedev wants is damn right lazy people posting lazy questions that do not show they have tried to find the answer for themselves. I think you will find my answer to look in the standard is net etiquette for lazy bastards wanting information ie RTFM. To imply that I was rude or anything even close I find an insult, look again at my post it twice uses the word please and even requests that if the standard is not understood then ask another question.

I would like you to clarify where I was "Aggressive, combative, [or] rude " but never mind all is well, I do not need gamedev just as much as it seems the gamedev community does not want correct answers.

Share this post


Link to post
Share on other sites
[quote name='magic_man' timestamp='1306451403' post='4816223']
I see. What gamedev wants is damn right lazy people posting lazy questions that do not show they have tried to find the answer for themselves. I think you will find my answer to look in the standard is net etiquette for lazy bastards wanting information ie RTFM. To imply that I was rude or anything even close I find an insult, look again at my post it twice uses the word please and even requests that if the standard is not understood then ask another question.

I would like you to clarify where I was "Aggressive, combative, [or] rude " but never mind all is well, I do not need gamedev just as much as it seems the gamedev community does not want correct answers.
[/quote]

Bye!

Share this post


Link to post
Share on other sites
[quote name='magic_man' timestamp='1306409653' post='4815994']
Please look in the standard!
If you have a question after that then please post it.
[/quote]

Not particularly rude in itself, although it does not answer the question and does not save much effort compared with the answers you actually provided later.


[quote name='magic_man' timestamp='1306410027' post='4815998']
[b]Incorrect replies like yours have no place at all[/b]. The short story is that it is implementation defined where each of these look for files and even that they may look in the same place.
[/quote]

Emphasis added by me. Somewhat rude, particularly as rip-off provided a link to MSDN that very strongly supports the answer that he gave as one that is correct, as far as practicality is concerned. The link also provides more nuance, should the OP desire it.


[quote name='magic_man' timestamp='1306440974' post='4816160']
OK this thread confuses me somewhat. Factually incorrect information gets voted up and [b]factually correct information which asks the [b]lazy[/b] OP to do some leg work themselves gets voted down? With a post about headlights also getting voted up. Erm let me check again is this the Lounge![/b][/quote]

Emphasis again added by me. Calling the OP lazy is certainly not polite (although perhaps not completely unfounded, I don't know)-- especially when you could easily have given your eventual answer upfront for a similar amount of effort. And not to nit-pick, but telling someone to look in the standard isn't factually correct information.

[quote][quote] [color="#1c2837"][size="2"]Why don't we just close every pure C++ thread - since the correct answers are all in the standard. [/quote][/size][/color]
[color="#1c2837"][size="2"]That sounds like an excellent idea but what in the OP's post says it is C++?[/size][/color]
[/quote]

Combative and petulant. As I mentioned above, the particular language chosen is irrelevant to rip-off's comment. An unnecessary comment to anything that came before which can only be response to rip-off's comment if you totally miss the content of what he said.

[quote name='magic_man' timestamp='1306451403' post='4816223']
I see. What gamedev wants is damn right lazy people posting lazy questions that do not show they have tried to find the answer for themselves. I think you will find my answer to look in the standard is net etiquette for lazy bastards wanting information ie RTFM. To imply that I was rude or anything even close I find an insult, look again at my post it twice uses the word please and even requests that if the standard is not understood then ask another question.[/quote]

Expecting someone to at least try looking something up first is indeed reasonable etiquette. Asking a basic question without such an attempt is not. But someone else displaying less than perfect etiquette is no reason to conduct yourself even more objectionably, which you quickly descended to.

Your initial reply was not really rude, as discussed above, but also directed the OP to a document which he may or may not have had available to him, and is quite long and dense besides. It's unfortunate that you feel insulted by my impression of your tone in this thread. But if you re-read it, do you really feel as though you were nothing but polite and reasonable throughout?

[quote]
I would like you to clarify where I was "Aggressive, combative, [or] rude " but never mind all is well, I do not need gamedev just as much as it seems the gamedev community does not want correct answers.
[/quote]

See above for the requested clarifications. I did not say that you yourself were all of those all the time, or that you are an example of the worst of them or even a particularly bad example. Just that such behavior invites downvotes, because it is discouraged by the community. You have several downvotes in this thread, and as you said your information is not incorrect, so they can't be from that. That leaves your comportment.

As for leaving gamedev, we'll be sorry to see you and your expertise go. But you are as free to stop coming at any time as you are to simply not respond to threads and questions that annoy you.

Share this post


Link to post
Share on other sites
It seems to be troll's month, meh.

includes with < > is to load include files relative the include directory you tell your compiler to look up for. (in VS there is a configuration option that is Include Directory or something). (-I from the command line?)
includes with "" is to load include files relative to your project's directory.

Share this post


Link to post
Share on other sites
@D.Chhetri: the link I had for the latest draft (N3290/N3291) seems to be broken (glad I downloaded it).
Here's the previous one, just 2 months older: [url="http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2011/n3242.pdf"]http://www.open-std..../2011/n3242.pdf[/url]
The definitive(?) 0x standard is due for after the final approval in august. If all goes well, that is.

Share this post


Link to post
Share on other sites
I will leave you with this parting gift.
[quote name='rip-off' timestamp='1306409827' post='4815995']
Short story: The angle bracket version is for external header files, the quotation marks are for your own header files. See [url="http://msdn.microsoft.com/en-us/library/36k2cdd4(v=vs.80).aspx"]here[/url] for a full explanation.
[/quote]

[b]wrong[/b]

[quote name='owl']
[color="#1c2837"][size="2"]It seems to be troll's month, meh.[/size][size="2"][/quote][/size][/color]
[color="#1c2837"] [size="2"]Yes it does.[/size] [size="2"][color="#000000"][size="3"]
[quote name='owl'][/size]
[size="2"][color="#1c2837"] [/color][/size][/color][/size][size="2"]includes with < > is to load include files relative the include directory you tell your compiler to look up for. (in VS there is a configuration option that is Include Directory or something). (-I from the command line?)[/size][size="2"]includes with "" is to load include files relative to your project's directory.[/size][size="2"][/quote][/size][/color]
[color="#1c2837"] [size="2"][b]wrong[/b][/size][/color]
[color="#1c2837"][size="2"][b]
[/b][/size][/color]
[color="#1c2837"][size="2"][b]
[/b][/size][/color]
[color="#1c2837"][size="2"][/size][size="2"][b][quote]Reputation of [b]1000+[/b] equals helpfull.

Reputation of [b]0[/b] equals unhelpfull.[/b][/size][/color]
[color="#1c2837"][size="2"][/quote][/size][/color]
[color="#1c2837"][size="2"][b]Wrong[/b]
[/size][size="2"]Now then lets have some facts and then question why you are voting for incorrect answers.[/size] [size="2"]C99[/size][size="2"][quote][/size]
[size="2"]6.10.2 Source file inclusion
[/size]
[size="2"]Constraints[/size]
[size="2"]1 A #include directive shall identify a header or source file that can be processed by the implementation.[/size]
[size="2"]Semantics[/size]
[size="2"]2 A preprocessing directive of the form[/size]
[size="2"]# include <h-char-sequence> new-line[/size]
[size="2"]searches a sequence of [b]implementation-defined[/b] places for a header identified uniquely by the specified sequence between the < and > delimiters, and causes the replacement of that directive by the entire contents of the header. How the places are specified or the header identified is [b]implementation-defined[/b].[/size]
[size="2"]3 A preprocessing directive of the form[/size]
[size="2"]# include "q-char-sequence" new-line[/size]
[size="2"]causes the replacement of that directive by the entire contents of the source file identified by the specified sequence between the " delimiters. The named source file is searched for in an [b]implementation-defined[/b] manner. If this search is not supported, or if the search fails, the directive is reprocessed as if it read[/size]
[size="2"]# include <h-char-sequence> new-line with the identical contained sequence (including > characters, if any) from the original[/size]
[size="2"]directive.[/size]
[size="2"]142) As indicated by the syntax, a preprocessing token shall not follow a #else or #endif directive before the terminating new-line character. However, comments may appear anywhere in a source file, including within a preprocessing directive.[/size]
[size="2"]§6.10.2 Language 149[/size]
[size="2"]7[/size]
[size="2"]8[/size]
[size="2"]EXAMPLE 1 The most common uses of #include preprocessing directives are as in the following: #include <stdio.h>[/size]
[size="2"]#include "myprog.h" EXAMPLE 2 This illustrates macro-replaced #include directives:[/size]
[size="2"]#if VERSION == 1 #define INCFILE "vers1.h"[/size]
[size="2"]#elif VERSION == 2 #define INCFILE "vers2.h" // and so on[/size]
[size="2"]#else[/size]
[size="2"]#define INCFILE "versN.h" #endif[/size]
[size="2"]#include INCFILE[/size]
[size="2"]Forward references: macro replacement (6.10.3).[/size]
[size="2"]143) Note that adjacent string literals are not concatenated into a single string literal (see the translation phases in 5.1.1.2); thus, an expansion that results in two string literals is an invalid directive.[/size]
[size="2"]ISO/IEC 9899:1999 (E) ©ISO/IEC[/size]
[size="2"]4 A preprocessing directive of the form[/size]
[size="2"]# include pp-tokens new-line[/size]
[size="2"](that does not match one of the two previous forms) is permitted.[b](OO who would have thought)[/b] The preprocessing tokens after include in the directive are processed just as in normal text. (Each identifier currently defined as a macro name is replaced by its replacement list of preprocessing tokens.) The directive resulting after all replacements shall match one of the two previous forms.143) The method by which a sequence of preprocessing tokens between a < and a > preprocessing token pair or a pair of " characters is combined into a single header name preprocessing token is [b]implementation-defined[/b].[/size]
[size="2"]5 The implementation shall provide unique mappings for sequences consisting of one or more letters or digits (as defined in 5.2.1) followed by a period (.) and a single letter. The first character shall be a letter. The implementation may ignore the distinctions of alphabetical case and restrict the mapping to eight significant characters before the period.[/size]
[size="2"]6 A #include preprocessing directive may appear in a source file that has been read because of a #include directive in another file, up to an implementation-defined nesting limit (see 5.2.4.1).[/size][size="2"][/quote][/size] [size="2"]C++ 2003[/size][size="2"][quote][/size]

[size="2"]16.2 Source file inclusion [cpp.include][/size]
[size="2"]1 A #include directive shall identify a header or source file that can be processed by the implementation. 2 A preprocessing directive of the form[/size]
[size="2"]# include <h-char-sequence> new-line[/size]
[size="2"]searches a sequence of [b]implementation-defined[/b] places for a header identified uniquely by the specified sequence between the < and > delimiters, and causes the replacement of that directive by the entire contents of the header. How the places are specified or the header identified is [b]implementation-defined[/b].[/size]
[size="2"]3 A preprocessing directive of the form # include "q-char-sequence" new-line[/size]
[size="2"]causes the replacement of that directive by the entire contents of the source file identified by the specified sequence between the " delimiters. The named source file is searched for in an [b]implementation-defined[/b] manner. If this search is not supported, or if the search fails, the directive is reprocessed as if it read[/size]
[size="2"]# include <h-char-sequence> new-line with the identical contained sequence (including > characters, if any) from the original directive.[/size]
[size="2"]4 A preprocessing directive of the form # include pp-tokens new-line[/size]
[size="2"](that does not match one of the two previous forms) is permitted[b](And again OOOO)[/b]. The preprocessing tokens after include __________________ 138) Thus, the constant expression in the following #if directive and if statement is not guaranteed to evaluate to the same value in these two contexts.[/size]
[size="2"]#if ’z’ - ’a’ == 25 if (’z’ - ’a’ == 25)[/size]
[size="2"]139) As indicated by the syntax, a preprocessing token shall not follow a #else or #endif directive before the terminating new-line character. However, comments may appear anywhere in a source file, including within a preprocessing directive.[/size]
[size="2"]309[/size]
[size="2"]ISO/IEC 14882:2003(E) ? ISO/IEC 16.2 Source file inclusion 16 Preprocessing directives[/size]
[size="2"]in the directive are processed just as in normal text (each identifier currently defined as a macro name is replaced by its replacement list of preprocessing tokens). If the directive resulting after all replacements does not match one of the two previous forms, the behavior is undefined.140) The method by which a sequence of preprocessing tokens between a < and a > preprocessing token pair or a pair of " characters is combined into a single header name preprocessing token is implementation-defined.[/size]
[size="2"]5 The mapping between the delimited sequence and the external source file name is implementation-defined. The implementation provides unique mappings for sequences consisting of one or more nondigits (2.10) followed by a period (.) and a single nondigit. The implementation may ignore the distinctions of alpha- betical case.[/size]
[size="2"]6 A #include preprocessing directive may appear in a source file that has been read because of a #include directive in another file, up to an implementation-defined nesting limit.[/size]
[size="2"]7 [Example: The most common uses of #include preprocessing directives are as in the following: #include <stdio.h>[/size]
[size="2"]#include "myprog.h"[/size]
[size="2"]—end example][/size]
[size="2"][/quote][/size]
[size="2"]
[/size][/color]
[color="#1c2837"][size="2"]And finally[/size][/color]
[color="#1c2837"][size="2"][quote][/size][/color][color=#1C2837][size=2]Bye![/quote][/size][/color]
[color=#1C2837][size=2][b]Correct[/b][/size][/color]

Share this post


Link to post
Share on other sites
The more practical individuals in this thread are talking about the difference on actual implementations. Actual C++ compilers tend to behave as explained. The theoretical answers here are interesting but ultimately useless, and protesting that they are somehow more correct to the point where they invalidate the practical answers comes across as extremely pedantic.

Share this post


Link to post
Share on other sites
[quote name='rip-off' timestamp='1306514009' post='4816477']
The more practical individuals in this thread are talking about the difference on actual implementations. Actual C++ compilers tend to behave as explained. The theoretical answers here are interesting but ultimately useless, and protesting that they are somehow more correct to the point where they invalidate the practical answers comes across as extremely pedantic.
[/quote]

[b]wrong![/b]
[b]
[/b]
XD

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this