standards

git: change styling (whitespace) without changing ownership/blame?

两盒软妹~` 提交于 2019-11-27 07:12:40
We have a massive, ancient codebase that needs a lot of cleanup. We have always had coding standards and everyone has always tried to follow them, but they were not enforced so over time a lot of violations have creeped in. Many of them are just whitespace issues, like using tabs instead of spaces, or spaces where there shouldn't be any, or missing spaces where they should be. We are going to start actively enforcing our coding standards to make sure more violations don't creep in, but it's difficult to enforce them in an automated way on only the changes, so it would be nice to clean up these

Is auto_ptr deprecated?

空扰寡人 提交于 2019-11-27 06:43:05
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? David Rodríguez - dribeas 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::unique_ptr with move semantics for single ownership that can be used inside

Why in g++ std::intmax_t is not a __int128_t?

二次信任 提交于 2019-11-27 06:42:44
问题 My question is pretty simple: as std::intmax_t is defined as the maximum width integer type according to cppreference, why it does not correspond to __int128_t in GCC? 回答1: I believe this is a violation of the C and C++ standards -- either that, or gcc doesn't consider __int128_t to be an integer type. The C standard (both the 1999 and 2011 editions) doesn't require intmax_t to be one of the standard types; it's required to be "a signed integer type capable of representing any value of any

How to make IE support min-width / max-width CSS properties?

老子叫甜甜 提交于 2019-11-27 06:39:38
问题 This question was migrated from Web Applications Stack Exchange because it can be answered on Stack Overflow. Migrated 8 years ago . Are these properties not considered standard CSS? I'm using something like this, which works properly on Chrome 12, FF4, Opera 11, and Safari 5, but on IE9 the min-width is not respected if width < min-width . <span style="float:left; width:11%; min-width:150px;"> ... </span> Edit: a little annoyed at the liberal editing and migrating of my question, but w/e.

C++ Standard On The Address of Inherited Members

空扰寡人 提交于 2019-11-27 06:35:10
问题 Does the C++ standard say anything on the address of inherited members? For example if I inherit an int member or a non - virtual method, does it say anything about its address, or a virtual member: if I dont overide it, if I do? The constructor, if I use a previous constructor? Operators, overloaded operators, template members? Does it say anything about these things? 回答1: Standard, section 1.8 is about the C++ object model. It doesn't say much: the object is a region of memory (but it may

When to use each method of launching a subprocess in Ruby

北城余情 提交于 2019-11-27 06:24:40
1. `` The Backtick defined in Kernel 1. a) %x{} Percent X < alternate syntax for The Backtick defined in parse.y, see discussion 2. system() Kernel#system 3. fork() Kernel#fork, Process#fork 4. open() open a pipe Kernel#open 4.a. IO.popen() < behaves the same as open() open a pipe IO#popen 4.b. open("|-") fork to a pipe 4.c. IO.popen("-") < behaves the same as open("|-") fork to a pipe see discussion 5. Open3.popen3() require 'open3' stdlib Open3 6. PTY.spawn() require 'pty' stdlib PTY 7. Shell.transact() require 'shell' stdlib Shell When should one forsake the trusty back-tick for one of the

Why is 'object slice' needed in C++ ? Why it is allowed ? For more bugs?

泄露秘密 提交于 2019-11-27 06:02:51
问题 Why C++ standard allow object slice ? Please don't explain c++ object slice concept to me as I knew that. I am just wondering what's the intention behind this c++ feature(object slice) design ? To get novice more bugs? Wouldn't it be more type safe for c++ to prevent object slice ? Below is just a standard and basic slice example: class Base{ public: virtual void message() { MSG("Base "); } private: int m_base; }; class Derived : public Base{ public: void message() { MSG("Derived "); }

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

陌路散爱 提交于 2019-11-27 06:02:19
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 Joseph Mansfield 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-declarator-list opt ; attribute-specifier-seq decl-specifier-seq opt init-declarator-list ; The

Why is max length of C string literal different from max char[]?

帅比萌擦擦* 提交于 2019-11-27 05:54:59
问题 Clarification : Given that a string literal can be rewritten as a const char[] (see below), imposing a lower max length on literals than on char[] s is just a syntactic inconvenience. Why does the C standard encourage this? The C89 standard has a translation limit for string literals: 509 characters in a character string literal or wide string literal (after concatenation) There isn't a limit for a char arrays; perhaps 32767 bytes in an object (in a hosted environment only) applies (I'm not

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

﹥>﹥吖頭↗ 提交于 2019-11-27 05:50:51
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 with Javascript. Is there a right answer to this? There isn't one. I use underscores all the time, due to