standards

Using of not captured variable in lambda

牧云@^-^@ 提交于 2019-12-07 11:33:37
问题 I can not quite understand an example from C++14 standard draft N4140 5.1.2.12 [expr.prim.lambda] . A lambda-expression with an associated capture-default that does not explicitly capture this or a variable with automatic storage duration (this excludes any id-expression that has been found to refer to an initcapture’s associated non-static data member), is said to implicitly capture the entity (i.e., this or a variable) if the compound-statement: odr-uses the entity, or names the entity in a

Storage Commitment Service: why I really need a what is the real purpose?

☆樱花仙子☆ 提交于 2019-12-07 11:03:50
问题 I'm wondering why I really need of commitment after a c-store command; I can understand the commit is a sort of assurance about the fact the message was actually taken in charge by the storage and the storage takes the responsibility of it, but I wonder why is not safe enough to rely on the response status ? I read some explanations about that but none convinced me all the way. As far as I understood a commit can be required or better desirable basically because you can not totally trust the

How to compute standard error for predicted data in R using predict

随声附和 提交于 2019-12-07 10:42:29
Here is my data: a <- c(60, 65, 70, 75, 80, 85, 90, 95, 100, 105) b <- c(26, 24.7, 20, 16.1, 12.6, 10.6, 9.2, 7.6, 6.9, 6.9) a_b <- cbind(a,b) plot(a,b, col = "purple") abline(lm(b ~ a),col="red") reg <- lm(b ~ a) I would like to use the predict function in order to compute the standard error for the predicted b value at 110. z <- predict(reg, newdata=data.frame(year=110), se.fit=TRUE) This is the output I get, but I think this is just giving me the standard errors for my 10 time points, but not the new 11th data point: z $fit 1 2 3 4 5 6 7 8 9 10 24.456364 22.146061 19.835758 17.525455 15

How do I write in-code comments and documentation in a proper way? Is there any standard for this? [closed]

删除回忆录丶 提交于 2019-12-07 09:30:15
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed last year . I want to add documentation in my code by means of comment lines. Is there any standard format for this? For example, consider the code below: class Arithmetic { // This method adds two numbers, and returns the result. // dbNum1 is the first number to add, and dbNum2 is second.

mysql should i use apostrophe in mysql queries?

会有一股神秘感。 提交于 2019-12-07 08:17:05
问题 What is the correct way of writing a query to a MySQL database on numeric data-types: SELECT * FROM accounts WHERE id = 5; or SELECT * FROM accounts WHERE id = '5'; Mainly I prefer the last one, using ' because it is more consistent with text data-types. Does it effect the performance? 回答1: Quotes are for strings, MySQL is going to read those quotes and then cast it to an integer, this is slower then just handing it an int to begin with. Honestly the performance difference is minor, but it is

Changes in POSIX 2013 revision

淺唱寂寞╮ 提交于 2019-12-07 08:15:17
问题 According to the POSIX FAQ, the standard has been revised and ratified by IEEE in 2013. What changed from the previous standard, from 2008? 回答1: According to the abstract in the online edition, POSIX.1-2008 is simultaneously IEEE Std 1003.1™-2008 and The Open Group Technical Standard Base Specifications, Issue 7. This 2013 Edition includes IEEE Std 1003.1-2008/Cor 1-2013 incorporated into IEEE Std 1003.1-2008 (the base document). The 2013 edition incorporates Technical Corrigendum 1

Where does the standard talk about aliasing?

拜拜、爱过 提交于 2019-12-07 06:04:15
问题 Where in the C++ standard does it talk about aliasing? I looked at the ToC and saw no mention of the word 'alias'. I tried to look in the one definition rule (3.2) and a search of 'alias' had no results there. I'm at a loss where it may be. I'm looking for memory aliasing 回答1: Aliasing is mainly discussed in §3.10[basic.lval]/10: If a program attempts to access the stored value of an object through a glvalue of other than one of the following types the behavior is undefined: 52 the dynamic

c standard and bitshifts

浪尽此生 提交于 2019-12-07 04:49:54
问题 This question was first inspired by the (unexpected) results of this code: uint16_t t16 = 0; uint8_t t8 = 0x80; uint8_t t8_res; t16 = (t8 << 1); t8_res = (t8 << 1); printf("t16: %x\n", t16); // Expect 0, get 0x100 printf(" t8: %x\n", t8_res); // Expect 0, get 0 But it turns out this makes sense: 6.5.7 Bitwise shift operators Constraints 2 Each of the operands shall have integer type Thus the originally confused line is equivalent to: t16 = (uint16_t) (((int) t8) << 1); A little non-intuitive

Microsoft _s functions, are they part of the C++ standard now?

浪尽此生 提交于 2019-12-07 03:44:54
问题 I just recently changed my IDE to MS Visual Studio 2005 coming from MSVC++ 6, and I've gotten a lot of deprecation warnings. Rather than ignore the warning, I started to change them to the _s equivalents. However, I then found out that these were microsoft-only implementations. I read somewhere that they were pushing for these to become part of the standard. Is it? Is it a good idea to use these _s functions? Or should I use something else? Thanks. 回答1: The *_s() functions are not part of the

Why are function argument names unimportant in c++ declarations?

半腔热情 提交于 2019-12-07 02:59:27
问题 Function argument names in declarations (that most likely reside in the header file) are seemingly completely ignored by the compiler. What are the reasons for allowing the following to compile using either declaration version 1 or 2? implementation void A::doStuff(int numElements, float* data) { //stuff } declaration - Version 1 class A { public: void doStuff(int numElements, float* data); } declaration - Version 2 class A { public: void doStuff(int, float*); } 回答1: The compiler only needs