Header Files

Started by
20 comments, last by _the_phantom_ 12 years, 10 months ago
OK this thread confuses me somewhat. Factually incorrect information gets voted up and factually correct information which asks the lazy 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!

[color="#1C2837"]Why don't we just close every pure C++ thread - since the correct answers are all in the standard. [/quote]
[color="#1C2837"]That sounds like an excellent idea but what in the OP's post says it is C++?
"You insulted me!" I did not say that in the private message Tom Sloper!
Advertisement

OK this thread confuses me somewhat. Factually incorrect information gets voted up and factually correct information which asks the lazy 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!


Reputation is about more than just whether or not you are factually correct. It also reflects your broader value to the community. Aggressive, combative, and rude people do damage to the community by making any thread in which they participate harsher and more highly charged, even if they present information that is factually accurate They damage the community also by making these boards a less inviting place for new members of all skill levels and interests.

Your statement "Look in the standard" not only does not answer the question, but also is longer than an answer which you might have given, like "It depends". Even a slightly longer sentence such as "It's implementation defined." would have been a low effort way to answer the OP's question, compared both to the post that you actually made as well as to just not posting anything.

You were downvoted because your posts are the sort that the voters would like to see less of around here. Still confused?



[color="#1c2837"]That sounds like an excellent idea but what in the OP's post says it is C++?
[/quote]

It's not an unreasonable assumption to make that the OP might have been talking about C++. But rip-off's point stands with any language. These boards would be a barren place if no one was allowed to ask questions because the answer might be (or even definitely is) in some expensive document. Going further, why even teach programming in classes? People can just read the language specs and then fend for themselves.

If you feel that a question is beneath you, an easy way to avoid having the poster waste your time with their ignorance is to just not respond.

-------R.I.P.-------

Selective Quote

~Too Late - Too Soon~

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.
"You insulted me!" I did not say that in the private message Tom Sloper!

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.


Bye!

Please look in the standard!
If you have a question after that then please post it.


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.



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.


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.



OK this thread confuses me somewhat. Factually incorrect information gets voted up and factually correct information which asks the lazy 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!


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.

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


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.


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?


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.

-------R.I.P.-------

Selective Quote

~Too Late - Too Soon~

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.
[size="2"]I like the Walrus best.
Reputation of 1000+ equals helpfull.

Reputation of 0 equals unhelpfull. ;)
@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: http://www.open-std..../2011/n3242.pdf
The definitive(?) 0x standard is due for after the final approval in august. If all goes well, that is.
I will leave you with this parting gift.

Short story: The angle bracket version is for external header files, the quotation marks are for your own header files. See here for a full explanation.


wrong

It seems to be troll's month, meh.

[color="#1c2837"] Yes it does. [color="#000000"]
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.

[color="#1c2837"] wrong
[color="#1c2837"]

[color="#1c2837"]

[color="#1c2837"]
Reputation of 1000+ equals helpfull.

Reputation of 0 equals unhelpfull.

[color="#1c2837"][/quote]
[color="#1c2837"]Wrong
Now then lets have some facts and then question why you are voting for incorrect answers. C99

6.10.2 Source file inclusion

Constraints
1 A #include directive shall identify a header or source file that can be processed by the implementation.
Semantics
2 A preprocessing directive of the form
# include <h-char-sequence> new-line
searches a sequence of implementation-defined 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 implementation-defined.
3 A preprocessing directive of the form
# include "q-char-sequence" new-line
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 implementation-defined manner. If this search is not supported, or if the search fails, the directive is reprocessed as if it read
# include <h-char-sequence> new-line with the identical contained sequence (including > characters, if any) from the original
directive.
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.
§6.10.2 Language 149
7
8
EXAMPLE 1 The most common uses of #include preprocessing directives are as in the following: #include <stdio.h>
#include "myprog.h" EXAMPLE 2 This illustrates macro-replaced #include directives:
#if VERSION == 1 #define INCFILE "vers1.h"
#elif VERSION == 2 #define INCFILE "vers2.h" // and so on
#else
#define INCFILE "versN.h" #endif
#include INCFILE
Forward references: macro replacement (6.10.3).
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.
ISO/IEC 9899:1999 (E) ©ISO/IEC
4 A preprocessing directive of the form
# include pp-tokens new-line
(that does not match one of the two previous forms) is permitted.(OO who would have thought) 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 implementation-defined.
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.
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).[/quote] C++ 2003


16.2 Source file inclusion [cpp.include]
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
# include <h-char-sequence> new-line
searches a sequence of implementation-defined 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 implementation-defined.
3 A preprocessing directive of the form # include "q-char-sequence" new-line
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 implementation-defined manner. If this search is not supported, or if the search fails, the directive is reprocessed as if it read
# include <h-char-sequence> new-line with the identical contained sequence (including > characters, if any) from the original directive.
4 A preprocessing directive of the form # include pp-tokens new-line
(that does not match one of the two previous forms) is permitted(And again OOOO). 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.
#if ’z’ - ’a’ == 25 if (’z’ - ’a’ == 25)
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.
309
ISO/IEC 14882:2003(E) ? ISO/IEC 16.2 Source file inclusion 16 Preprocessing directives
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.
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.
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.
7 [Example: The most common uses of #include preprocessing directives are as in the following: #include <stdio.h>
#include "myprog.h"
—end example]
[/quote]


[color="#1c2837"]And finally
[color="#1c2837"]
[color=#1C2837][size=2]Bye![/quote]
[color=#1C2837][size=2]Correct
"You insulted me!" I did not say that in the private message Tom Sloper!
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.

This topic is closed to new replies.

Advertisement