standards

Serial port - how to perform safe search for my device?

家住魔仙堡 提交于 2019-12-24 01:49:22
问题 Im writing application that communicate (via serial port) with electronic device which i designed myself. When my PC application starts - it opens available COM ports one by one and it sends some string ("What are you?" for example). My device is programmed, to reply to that "magic question" with own ID (for example: "I am evil device for supervising employees"). When my PC software receive that "magic reply" it starts working normally and its not searching other ports anymore. Of course im

Where does C++ standard define the value range of float types?

核能气质少年 提交于 2019-12-24 01:45:24
问题 As far as I know floating point values are of the form n * 2^e, with float range being n = -(2^23-1) - (2^23-1), and e = -126 - 127, double range being n = -(2^52-1) - (2^52-1), and e = -1022 - 1023 I was looking through the C++ standard, but failed to find the place where the standard specifies this, or mandates the association of the float, double and long double types with ranges defined in other (IEEE) standards. The only related thing I found in 3.9.1.8 is: There are three floating point

is uninitialized_copy/fill(In first, In last, For dest, A &a) an oversight in the c++ standard?

本小妞迷上赌 提交于 2019-12-23 21:15:34
问题 I like to know how things work and as such have been delving deep into the c++ standard library. Something occurred to me the other day. It is required that containters (for example: std::vector<int, std::allocator<int> > ) use the allocator specified for allocations. Specifically the standard says: 23.1.8 Copy constructors for all container types defined in this clause copy an allocator argument from their respective first parameters. All other constructors for these container types take an

Linker gives error “undefined symbol” for integral static const members used in certain contexts [duplicate]

拜拜、爱过 提交于 2019-12-23 21:13:12
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: C++ - defining static const integer members in class definition Note: There are several extant questions re similar issues, but I have reviewed many of them and cannot find an answer that explains this behavior: Say I have code such as the following (in a header file) class Foo { static const int TEST = 33; public: void willItWork(void) { printf("%d", std::max(TEST, 75)); // embedded platform, no streams } };

PowerShell: How To Use Standard Output In Place of Filename

浪子不回头ぞ 提交于 2019-12-23 20:52:03
问题 I'm writing a C# class that runs a Process (REG) to export registry keys. REG requires that you specify a filename to export to but I would rather have the output of REG directed to the standard output so I can capture it directly in my C# code (using Process.StandardOutput). Is there a way in PowerShell to specify the standard output as the filename? 回答1: If you have to use the REG program (rather than use PowerShell to query/dump the registry - or even just do it in the C# program itself),

Browser behavior on 403 Forbidden error

余生长醉 提交于 2019-12-23 20:26:37
问题 My server returns a 403 forbidden error when a user tries to access a resource that they do not have access to. Along with the header the server also writes a small message describing the error. In Firefox the error message gets displayed nicely and the user knows what's going on. In Internet Explorer the message is hidden and replaced with the 403 Forbidden standard error page. Are there any specific rules that allow me to display an error message across all browsers while still setting the

Why aren't parts of the Concurrency TS going in C++17?

余生长醉 提交于 2019-12-23 19:36:52
问题 According to Michael Wong the Concurrency TS is not going in, despite complete, apparently Although there is implementation experience, it was just approved and is too fresh to be voted to be added to C++17. My favourite proposal was originally in N3327 but I first read of it in N3857/N3784 and had expected it for C++14. futures has had and implementation of .then() in Boost since 2013 and Microsoft has implemented a form of them in PPL so any issues will have been hit upon, discussed and

Is there a standard client behaviour for submitting an empty select multiple?

浪尽此生 提交于 2019-12-23 18:29:37
问题 http://www.w3.org/TR/html401/interact/forms.html#edef-SELECT Doesn't specify how the client should behave if the submitted select multiple is empty. Does anyone know whether there is a standard for that ? 回答1: Sadly, I do not have the time to test this, but I hope the following can help you... If I am not mistaken, the first element is selected by default when the page is loaded. Therefore, create a very simple HTML file with a form and a select that has the multiple attribute active and with

Complexity of inserting sorted range into associative container

让人想犯罪 __ 提交于 2019-12-23 16:26:54
问题 The standard specifies (23.4.4.2:5, etc.) that constructing all four ordered associative containers ( map , multimap , set , multiset ) from a range [first, last) shall be linear in N = last - first if the range is already sorted. For merging a range (e.g. a container of the same type) into an existing container, however, 23.2.4:8 table 102 specifies only that insert ing a range [i, j) into the container shall have complexity N log(a.size() + N) where N = distance(i, j) . This would seem to

Add integers safely, and prove the safety

安稳与你 提交于 2019-12-23 16:24:17
问题 Programming course assignment asks to write a (safe) function that adds two integers, and show that the function is safe. The following code represents my solution. I am not an expert on the C standard (or on formal verification methods). So I would like to ask: Are there better (or different) solutions? Thank you #include <limits.h> /* Try to add integers op1 and op2. Return 0 (success) or 1 (overflow prevented). In case of success, write the sum to res. */ int safe_int_add(int * res, int