standards

Using Unicode in C++ source code

本秂侑毒 提交于 2019-11-26 13:05:02
What is the standard encoding of C++ source code? Does the C++ standard even say something about this? Can I write C++ source in Unicode? For example, can I use non-ASCII characters such as Chinese characters in comments? If so, is full Unicode allowed or just a subset of Unicode? (e.g., that 16-bit first page or whatever it's called.) Furthermore, can I use Unicode for strings? For example: Wstring str=L"Strange chars: â Țđ ě €€"; Johannes Schaub - litb Encoding in C++ is quite a bit complicated. Here is my understanding of it. Every implementation has to support characters from the basic

Semantically, which is more correct: a in h2, or h2 in a?

我的梦境 提交于 2019-11-26 12:43:42
问题 I\'m stuck deciding which to use as both seem to work. Should I be placing links <a> inside of <h2> elements? Or the other way around? What is the correct standard? 回答1: You can only place <h2> elements within <a> elements if you're working with HTML5, which allows any other elements within <a> elements. Previous specifications (or current ones however you want to look at them) never allowed this. The usual way of doing this is to place <a> within <h2> . This works, has always worked, and has

Is no parentheses on a constructor with no arguments a language standard?

落爺英雄遲暮 提交于 2019-11-26 12:20:37
I was compiling a C++ program in Cygwin using g++ and I had a class whose constructor had no arguments. I had the lines: MyClass myObj(); myObj.function1(); And when trying to compile it, I got the message: error: request for member 'function1' in 'myObj', which is of non-class type 'MyClass ()()' After a little research, I found that the fix was to change that first line to MyClass myObj; I could swear I've done empty constructor declarations with parentheses in C++ before. Is this probably a limitation of the compiler I'm using or does the language standard really say don't use parentheses

Use CSS to automatically add &#39;required field&#39; asterisk to form inputs

≯℡__Kan透↙ 提交于 2019-11-26 12:20:26
问题 What is a good way to overcome the unfortunate fact that this code will not work as desired: <div class=\"required\"> <label>Name:</label> <input type=\"text\"> </div> <style> .required input:after { content:\"*\"; } </style> In a perfect world, all required input s would get the little asterisk indicating that the field is required. This solution impossible since the CSS is inserted after the element content, not after the element itself, but something like it would be ideal. On a site with

How to put the WebBrowser control into IE9 into standards?

有些话、适合烂在心里 提交于 2019-11-26 12:18:48
i am using automation (i.e. COM automation) to display some HTML in Internet Explorer (9): ie = CoInternetExplorer.Create; ie.Navigate2("about:blank"); webDocument = ie.Document; webDocument.Write(szSourceHTML); webDocument.Close(); ie.Visible = True; Internet Explorer appears, showing my html, which starts off as: <!DOCTYPE html> <HTML> <HEAD> ... Note: the html5 standards-mode opt-in doctype html Except that the document is not in ie9 standards mode; it's in ie8 standards mode: If i save the html to my computer first: and then view that html document, IE is put into standards mode: My

Is auto_ptr deprecated?

ε祈祈猫儿з 提交于 2019-11-26 12:08:46
问题 Will auto_ptr be deprecated in incoming C++ standard? Should unique_ptr be used for ownership transfer instead of shared_ptr? If unique_ptr is not in the standard, then do I need to use shared_ptr instead? 回答1: UPDATE: This answer was written in 2010 and as anticipated std::auto_ptr has been deprecated. The advice is entirely valid. In C++0x std::auto_ptr will be deprecated in favor of std::unique_ptr . The choice of smart pointer will depend on your use case and your requirements, with std:

Should I use char** argv or char* argv[] in C?

 ̄綄美尐妖づ 提交于 2019-11-26 11:57:09
I'm just learning C and was wondering which one of these I should use in my main method. Is there any difference? Edit: So which one is more common to use? Johannes Schaub - litb As you are just learning C, I recommend you to really try to understand the differences between arrays and pointers first instead of the common things. In the area of parameters and arrays, there are a few confusing rules that should be clear before going on. First, what you declare in a parameter list is treated special. There are such situations where things don't make sense as a function parameter in C. These are

What are declarations and declarators and how are their types interpreted by the standard?

谁都会走 提交于 2019-11-26 11:50:16
问题 How exactly does the standard define that, for example, float (*(*(&e)[10])())[5] declares a variable of type \"reference to array of 10 pointer to function of () returning pointer to array of 5 float \"? Inspired by discussion with @DanNissenbaum 回答1: I refer to the C++11 standard in this post Declarations Declarations of the type we're concerned with are known as simple-declaration s in the grammar of C++, which are of one of the following two forms (§7/1): decl-specifier-seq opt init

What is the standard naming convention for html/css ids and classes?

天涯浪子 提交于 2019-11-26 11:45:54
问题 Does it depend on the platform you are using, or is there a common convention that most developers suggest/follow? There are several options: id=\"someIdentifier\"\' - looks pretty consistent with javascript code. id=\"some-identifier\" - looks more like html5-like attributes and other things in html. id=\"some_identifier\" - looks pretty consistent with ruby code and is still a valid identifier inside of Javascript I was thinking #1 and #3 above make the most sense because they play nicer

Deprecation of the static keyword… no more?

会有一股神秘感。 提交于 2019-11-26 11:45:30
In C++ it is possible to use the static keyword within a translation unit to affect the visibility of a symbol (either variable or function declaration). In n3092, this was deprecated: Annex D.2 [depr.static] The use of the static keyword is deprecated when declaring objects in namespace scope (see 3.3.6). In n3225, this has been removed. The only article I could find is somewhat informal. It does underline though, that for compatibility with C (and the ability to compile C-programs as C++) the deprecation is annoying. However, compiling a C program directly as C++ can be a frustrating