standards

Is it proper to place code, or content between the HTML </head> and <body> tags

情到浓时终转凉″ 提交于 2019-11-28 11:04:01
问题 Is it okay to place HTML code between the ending of the head area and before the beginning of the body area. I have done this before, on various sites without any problems, however, I would like to know whether this has any backwards compatibility issues, and also whether this is common, or good practice. For example: </head> <div id="header"> <h1>Heading</h1> Code & Content... </div><!-- #header --> <body> Code & Content... </body> 回答1: No, is not okay. All the content of the page should go

Is a header necessarily a file?

≡放荡痞女 提交于 2019-11-28 10:57:36
T.C. left an interesting comment to my answer on this question: Why aren't include guards in c++ the default? T.C. states: There's "header" and there's "source file". "header"s don't need to be actual files. What does this mean? Perusing the standard, I see plenty of references to both "header files" and "headers". However, regarding #include , I noticed that the standard seems to make reference to "headers" and "source files ". (C++11, § 16.2) A preprocessing directive of the form # include < h-char-sequence> new-line searches a sequence of implementation-defined places for a header

What does the [Note] in undefined behavior paragraph in C++ standard mean?

只愿长相守 提交于 2019-11-28 10:56:00
问题 As user Tony points out there's a [Note] in paragraph 1.3.12 of C++ standard saying permissible undefined behavior ranges from ignoring the situation completely with unpredictable results, to behaving during translation or program execution in a documented manner characteristic of the environment... Doesn't this contradict the definition of UB saying that ...this International Standard imposes no requirements ? I mean they say "no requirements" and then say "permissible UB" - right in the

Is the name of a cookie case sensitive?

最后都变了- 提交于 2019-11-28 10:40:01
A HTTP Cookie consists of a name-value pair and can be set by the server using this response: HTTP/1.0 200 OK Content-type: text/html Set-Cookie: name=value Set-Cookie: name2=value2; Expires=Wed, 09 Jun 2021 10:18:14 GMT Future requests from the client will then look like this: GET /spec.html HTTP/1.1 Host: www.example.org Cookie: name=value; name2=value2 Is the name of the cookie case sensitive? For example, if my server sends a response as such: HTTP/1.0 200 OK Content-type: text/html Set-Cookie: Aaaa=Bbbb Set-Cookie: aAaa=bBbb Set-Cookie: aaAa=bbBb Set-Cookie: aaaA=bbbB Is it reasonable to

A searchable Prolog language description online [closed]

半腔热情 提交于 2019-11-28 10:04:16
Is there a description of Prolog language (syntax and semantics) available online? There are a lot of reference manuals for implementations. But neither of those is a language description. For example the SWI Prolog manual states This manual does not describe the full syntax and semantics of Prolog. And refers to a set of books printed on paper, published in the nineteen eighties. And to ISO standard which is for money and "should be available from my country's ISO representative" gibberish. false The ISO standard is available for a very low price (currently USD 30 60) from the ANSI webstore

If I don't odr-use a variable, can I have multiple definitions of it across translation units?

我怕爱的太早我们不能终老 提交于 2019-11-28 09:51:12
The standard seems to imply that there is no restriction on the number of definitions of a variable if it is not odr-used (§3.2/3): Every program shall contain exactly one definition of every non-inline function or variable that is odr-used in that program; no diagnostic required. It does say that any variable can't be defined multiple times within a translation unit (§3.2/1): No translation unit shall contain more than one definition of any variable, function, class type, enumeration type, or template. But I can't find a restriction for non-odr-used variables across the entire program. So why

Why don't the standard C++ container adaptors provide a clear function?

这一生的挚爱 提交于 2019-11-28 09:40:53
Does anyone know why std::queue, std::stack, and std::priority_queue don't provide a clear() member function? I have to fake one like this: std::queue<int> q; // time passes... q = std::queue<int>(); // equivalent to clear() IIRC, clear() is provided by everything that could serve as the underlying container. Is there a good reason to not have the container adaptors provide it? Well, I think this is because clear was not considered a valid operation on a queue, a priority_queue or a stack (by the way, deque is not and adaptor but a container). The only reason to use the container adaptor queue

Why default return value of main is 0 and not EXIT_SUCCESS?

旧时模样 提交于 2019-11-28 09:00:12
The ISO 1998 c++ standard specifies that not explicitly using a return statement in the main is equivalent to use return 0 . But what if an implementation has a different standard "no error" code, for example -1 ? Why not use the standard macro EXIT_SUCCESS that would be replaced either by 0 or -1 or any other value depending on the implementation? C++ seems to force the semantic of the program, which is not the role of a language which should only describe how the program behaves. Moreover the situation is different for the "error" return value: only EXIT_FAILURE is a standard "error"

Why not enforce 2's complement in C++?

本秂侑毒 提交于 2019-11-28 08:57:42
The new C++ standard still refuses to specify the binary representation of integer types. Is this because there are real-world implementations of C++ that don't use 2's complement arithmetic? I find that hard to believe. Is it because the committee feared that future advances in hardware would render the notion of 'bit' obsolete? Again hard to believe. Can anyone shed any light on this? Background: I was surprised twice in one comment thread (Benjamin Lindley's answer to this question ). First, from piotr's comment: Right shift on signed type is undefined behaviour Second, from James Kanze's

Undefined behavior on reading object using non-character type when last written using character type

淺唱寂寞╮ 提交于 2019-11-28 08:17:05
Assuming unsigned int has no trap representations, do either or both of the statements marked (A) and (B) below provoke undefined behavior, why or why not, and (especially if you think one of them is well-defined but the other isn't), do you consider that a defect in the standard? I am primarily interested in the current version of the C standard (i.e. C2011), but if this is different in older versions of the standard, or in C++, I would also like to know about that. ( _Alignas is used in this program to eliminate any question of UB due to inadequate alignment. The rules I discuss in my