standards-compliance

__func__ C++11 function's local predefined variable, won't compile

坚强是说给别人听的谎言 提交于 2019-12-04 02:50:38
问题 The __func__ C++11 local predefined variable of a function does not compile in Visual Studio 2012 Professional (with Update 1 installed) with the default built-in Visual Studio 2012 (v110) compiler or the November 2012 CTP (v120_CTP_Nov2012) compiler. However, the editor does not complain with any red squiggly underline under __func__ . __func__ is supposed to give the name of its containing function, in this case foo , but this neither compiles nor make the editor complain: #include

Are Keyboard shortcuts mandatory for 508 compliance

限于喜欢 提交于 2019-12-04 01:33:35
I researched a lot on this and seem to be getting conflicting answers on SO and all of the web. I understand that with Section 508 that compliance DOES NOT equal accessibility. Biggest thing is that the UI/UX designer is being told that keyboard shortcuts for the dropdown menu NEEDS to have keyboard shortcuts to be 508 compliant. I see Windows Forms applications having this, but for web development I do not think that is mandatory to be "compliant" My other question that was answered is here: MVC 4 site 508 compliant I partially agree with thinice, but agree with the first two sentences of the

Why is a C++ template accepting an array not more specialized than one accepting a pointer according to GCC 5.3 and Clang 4.0?

此生再无相见时 提交于 2019-12-03 12:27:53
问题 Why are the next two template declarations ambiguous (so neither is more specialized than the other)? I know this question has been raised many times on Stack Overflow, but usually, people answer how to resolve ambiguity, not why it's happened. I. template <class T> void func(char* buf, T size) {} II. template <std::size_t N> void func(char (&buf)[N], std::size_t size) {} Trying to pass steps of the C++14 standard to resolve partial function template ordering (14.5.6.2): To produce the

Dependencies in Initialization Lists

旧街凉风 提交于 2019-12-03 11:00:51
Is this behavior well-defined? class Foo { int A, B; public: Foo(int Bar): B(Bar), A(B + 123) { } }; int main() { Foo MyFoo(0); return 0; } No, it's undefined. A will be initialized first (it's first in the class definition), and it uses uninitialized B . Class members are initialized in the order they appear in the class definition, irrespective of their order in the initialization list. Indeed, it is bad practice to mismatch the member definition order with the initialization list order. If your instance of Foo happened to have static duration, like in Foo f(0); int main(){} , the behavior

Is XHTML compliance pointless?

人盡茶涼 提交于 2019-12-03 09:52:57
I'm building a site right now, so far I've painfully forced everything to be compliant and it looks pretty much the same across browsers. However, I'm starting to implement some third party/free javascripts which do things like add attributes (eg. order=2). I could work around this but it's a pain, and I'm starting to lose my principals of making sure everything is valid. Really, is there any point to working around something like this? I got the HTMLValidator plugin for firefox, and looking at most major sites (including this one, google, etc.), they aren't valid XHTML or HTML. I have yet to

Gnu C++ macro __cplusplus standard conform?

自作多情 提交于 2019-12-03 09:24:15
The Gnu C++ compiler seems to define __cplusplus to be 1 #include <iostream> int main() { std::cout << __cplusplus << std::endl; } This prints 1 with gcc in standard c++ mode, as well as in C++0x mode, with gcc 4.3.4 , and gcc 4.7.0. The C++11 FDIS says in "16.8 Predefined macro names [cpp.predefined]" that The name __cplusplus is defined to the value 201103L when compiling a C++ translation unit. (Footnote: It is intended that future versions of this standard will replace the value of this macro with a greater value. Non-conforming com- pilers should use a value with at most five decimal

On the std::abs function

社会主义新天地 提交于 2019-12-03 08:37:56
问题 Is the std::abs() function well defined for ALL arithmetic types in C++11 and will return |x| with no problem of approximation? A weird thing is that with g++4.7, std::abs(char) , std::abs(short int) , std::abs(int) , std::abs(long int) and std::abs(long long int) seem to return a double (on the contrary of : http://en.cppreference.com/w/cpp/numeric/math/abs). And if the number is casted to a double, we could have some approximation error for very large number (like -9223372036854775806LL = 2

__USE_FILE_OFFSET64 vs. _FILE_OFFSET_BITS=64

拜拜、爱过 提交于 2019-12-03 06:47:55
问题 I am trying to maintain code that compiles on lots of different systems. I've seen a dozen different ways of asking for lseek that takes 64-bits. Some systems use lseek64 , some use lseeko , some require that you define _FILE_OFFSET_BITS=64 , and now I just found a new one that requires that you define __USE_FILE_OFFSET64 . Is there any standard to all of this? 回答1: There are getconf values in IEEE Std 1003.1-2004 (and a newer set in IEEE Std 1003.1-2008; see also the EXAMPLES section in

Why is a C++ template accepting an array not more specialized than one accepting a pointer according to GCC 5.3 and Clang 4.0?

我与影子孤独终老i 提交于 2019-12-03 02:02:09
Why are the next two template declarations ambiguous (so neither is more specialized than the other)? I know this question has been raised many times on Stack Overflow, but usually, people answer how to resolve ambiguity, not why it's happened. I. template <class T> void func(char* buf, T size) {} II. template <std::size_t N> void func(char (&buf)[N], std::size_t size) {} Trying to pass steps of the C++14 standard to resolve partial function template ordering (14.5.6.2): To produce the transformed template, for each type, non-type, or template template parameter (including template parameter

On the std::abs function

只谈情不闲聊 提交于 2019-12-02 22:23:18
Is the std::abs() function well defined for ALL arithmetic types in C++11 and will return |x| with no problem of approximation? A weird thing is that with g++4.7, std::abs(char) , std::abs(short int) , std::abs(int) , std::abs(long int) and std::abs(long long int) seem to return a double (on the contrary of : http://en.cppreference.com/w/cpp/numeric/math/abs ). And if the number is casted to a double, we could have some approximation error for very large number (like -9223372036854775806LL = 2^63-3 ). So do I have the guarantee that std::abs(x) will always return |x| for all arithmetic types ?