standards

Does the C preprocessor remove instances of “&*”?

自古美人都是妖i 提交于 2019-12-03 04:31:21
I was playing around with gcc and tried the following bit of code: int A = 42; int *B = &A; int *C = &*B; And C == &A , as expected. But when I try: int *B = NULL; int *C = &*B; Turns out C == NULL , and no segfault. So &*B is not actually dereferencing B before taking its address. My guess is that the preprocessor is stripping out instances of &* and *& before they even get to the compiler since they negate each other, but I can't find any documentation to verify whether this is standard C or compiler-specific. Is the preprocessor stripping out &* and *& , and can I expect this behavior from

Android layout examples that match “Metrics and Grids” recommendations

只谈情不闲聊 提交于 2019-12-03 04:08:08
问题 After trying to make sense of the Metrics and Grids page of the (fairly new) Android Design website, I gave up on a lot of things. So, basically, I'm trying to find the original layouts that are used in Android 4, so that I can apply the same concepts. To make this question more objective and not fail under the "too broad" axe of stackoverflow, I ask you for the layout that is used to recreate, exactly and fully , the examples on that page. Did Google provide them in the samples? Maybe a well

Where should validation logic be implemented?

孤街醉人 提交于 2019-12-03 03:53:50
When developing my interfaces (contracts) and the concrete implementations of them, both the data models as well as repositories, I find myself questioning where the validation logic should go. Part of me (which tends to win out) says that the class itself should be responsible for it's own validation (string max length, date buffers, etc), but the other part of me says this should be moved out to the repository because depending upon the persistence store, these values could change based on your repository implementation. I think there is some validation that MUST be done at the class level

Is the C programming language object-oriented?

白昼怎懂夜的黑 提交于 2019-12-03 03:01:20
问题 I was talking with a co-worker about C and C++ and he claimed that C is object-oriented, but I claimed that it was not. I know that you can do object-oriented-like things in C, but C++ is a true object-oriented language. What are your thoughts? Also, it triggered discussion on who decides what it means to be object-oriented and that it's tough to say what object-oriented really officially means. What are you thoughts on this? 回答1: If by "is C object oriented?" you mean "is C designed with

How to track newer C++ std documents of given topic?

若如初见. 提交于 2019-12-03 02:00:02
问题 Following is a C++ std document. The document number is N3721, which superseded the older N3634. Obviously, it's easy to track older documents of given topic. However, my question is: How to track newer documents of given topic? For example, if N3721 is superseded by a newer document, how to track the newer one? 回答1: For the newer proposals (ones that start with the letter P ) you can use wg21.link redirect service to obtain the latest document: wg21.link - WG21 redirect service. Usage: wg21

What does idl attribute mean in the WHATWG html5 standard document?

旧街凉风 提交于 2019-12-03 01:39:28
问题 While reading over the WHATWG's HTML5 - A technical specification for Web developers I see many references such as: Reflecting content attributes in IDL attributes Some IDL attributes are defined to reflect a particular content attribute. This means that on getting, the IDL attribute returns the current value of the content attribute, and on setting, the IDL attribute changes the value of the content attribute to the given value. and: In conforming documents, there is only one body element.

Does the C standard have a website for defect reports?

偶尔善良 提交于 2019-12-03 01:21:54
In my previous question , the discussion seems to imply that there might be a defect in the C standard, further implied by the top answerer's last sentence: The authors of the standard merely neglected to say so. I'm aware that C++ has an online website where you can search for defect reports, i.e. here is my search for null pointer constant , but is there something similar for the C standard? Shafik Yaghmour Keeping up with the C standards process is not as convenient as keeping up with the C++ process but by starting from the WG14 page we can find the Defect report summary for C11 linked at

ISO/IEC Website and Charging for C and C++ Standards

为君一笑 提交于 2019-12-03 00:57:21
The ISO C Standard (ISO/IEC 9899) and the ISO C++ Standard (ISO/IEC 14882) are not published online; instead, one must purchase the PDF for each of those standards. I am wondering what the rationale is behind this... is it not detrimental to both the C and C++ programming languages that the authoritative specification for these languages is not made freely available and searchable online? Doesn't this encourage the use of possibly inaccurate, non-authoritative sources for information regarding these languages? While I understand that much time and effort has gone into developing the C and C++

How to make `short-circuit evaluation` also available in `fold expressions`?

五迷三道 提交于 2019-12-03 00:35:35
#include <type_traits> #define FORWARD(arg)\ std::forward<decltype(arg)>(arg) template<typename... Args> constexpr bool AndL(Args&&... args) { return (... && FORWARD(args)); } template<typename... Args> constexpr bool AndR(Args&&... args) { return (FORWARD(args) && ...); } int main() { bool* pb = nullptr; false && (*pb = true); // ok at runtime. AndL(false, (*pb = true)); // error at runtime! AndR(false, (*pb = true)); // error at runtime! } The traditional && operator supports short-circuit evaluation , so false && (*pb = true) will be ok at runtime, but the following two cases are not. How

Align <hr> to the left in an HTML5-compliant way

白昼怎懂夜的黑 提交于 2019-12-02 23:35:35
Currently, I'm using <hr align="left" /> on my HTML5 page, but I've read that the align property was deprecated in XHTML 4.01 and supposedly removed from HTML5. I'd like to be using CSS rather than an inline attribute like this, but when I tried hr{align: left; max-width: 800px;} or hr{text-align: left;} or hr{left: 0;} or hr{float: left;} , it just showed up in the center. So what should I use instead of the inline attribute above? Stephen You're trying to use something in a way that (as Eliezer Bernart mentions.. and apparently that comment with the link to the MDN doc disappeared) no longer