standards

Interface to C++ objects through extern “C” functions

一世执手 提交于 2019-12-10 12:40:07
问题 Can an extern "C" function accept or return C++-specific data types, such as references, pointers-to-members, or non-POD classes (by value)? I cannot find anything in the C++ standard that forbids this. Logically, I would expect the standard to say something about it, as the C ABI is not necessarily suitable for passing such types around. The reason for me wanting to use C linkage has nothing to do with C compilers. The function is called only from C++ code. I just want to export unmangled

C++ Standards (newline ending of source files)

别等时光非礼了梦想. 提交于 2019-12-10 12:36:56
问题 I am referring to: Why should text files end with a newline? One of the answers quotes the C89 standard. Which in brief dictates that a file must end with a new line, which is not immediately preceded by a backslash. Does that apply to the most recent C++ standard? #include <iostream> using namespace std; int main() { cout << "Hello World!" << endl; return 0; } //\ Is the above valid? (Assuming there is a newline after //\, which I've been unable to display) 回答1: The given code is legal in

c++17 evaluation order with operator overloading functions

ⅰ亾dé卋堺 提交于 2019-12-10 12:30:36
问题 Regarding this question What are the evaluation order guarantees introduced by C++17? With this specification http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0145r3.pdf And this text from the specification Furthermore, we suggest the following additional rule: the order of evaluation of an expression involving an overloaded operator is determined by the order associated with the corresponding built-in operator, not the rules for function calls. Does this mean that these two

How to read standard output of my own application

血红的双手。 提交于 2019-12-10 11:56:49
问题 I have an application that must read it's own output that is written via Console.WriteLine("blah blah"); I'm trying Process p = Process.GetCurrentProcess(); StreamReader input = p.StandardOutput; input.ReadLine(); But it doesn't work because of "InvalidOperationException" at the second line. It says something like "StandardOutput wasn't redirected, or the process has not been started yet" (translated) How can I read my own output ? Is there another way to do that ? And to be complete how to

Does the C++ standard requires signed integers to have exactly one sign bit?

假装没事ソ 提交于 2019-12-10 11:39:13
问题 Consider the fundamental signed integer types of C++, namely: signed char , short int , int , long int and long long int , what does the current C++ standard require about their underlying bit representation? Does the constraints on their bit representation specify that they should include: optional padding bits mandatory value bits a mandatory sign bit that is 0 for positive values, and 1 for negative value if it exists, the sign bit should be the most significant bit Is this true? If not,

How to successfully use RDAP protocol instead of whois

那年仲夏 提交于 2019-12-10 10:25:28
问题 I'm a little confused about the new RDAP protocol and whenever it makes sense to pursue it any further. It looks to me like everyone agreed on it to be the successor of whois, but their databases seem empty. On ubuntu I tried rdapper, nicinfo and even their RESTful API: http://rdap.org/domain/google.com (this results in a "File not Found", but is correct according to here) Am I misunderstanding something? Is RDAP dead, did the service not start yet or am I doing something wrong? Nicinfo

Why is there no language support in C++ for all C++ standard library type traits?

核能气质少年 提交于 2019-12-10 10:24:41
问题 In C++ it is impossible to implement certain C++ standard library type traits without compiler intrinsics, using the C++ language only. Traits deal directly with C++ types. According to §17.6.1.3.2 freestanding implementations of the C++ standard library must implement <type_traits> . Doesn't this effectively mean that the C++ standard requires non-standard language extensions/compiler intrinsics from all compilers which support want to support freestanding C++ standard library

Best place to store static error strings

那年仲夏 提交于 2019-12-10 09:48:05
问题 I was wondering if anyone had any input on the best practice of where to store static error strings in a C# application. I have a visual studio 2010 solution that has 5 projects and have defined several constant error messages to be returned via a WCF REST web service in the form of a message. My current errors I have defined (hard-coded) are in the following format (CODE, MESSAGE): 999 - Your request could not be processed with the parameters specified. I am not asking how to create custom

Stop system entering 'standby'

徘徊边缘 提交于 2019-12-10 09:30:04
问题 How can i stop the host machine entering standby mode while my application is running? Is there any win32 api call to do this? 回答1: There are two APIs, depending on what version of Windows. XP,2000, 2003: http://msdn.microsoft.com/en-us/library/aa373247(VS.85).aspx Respond to PBT_APMQUERYSUSPEND. Vista, 2008: http://msdn.microsoft.com/en-us/library/aa373208(VS.85).aspx There could be many valid reasons to prevent the computer from going to sleep. For example, watching a video, playing music,

Is there a standard resource for the “default action” of HTML elements? [closed]

会有一股神秘感。 提交于 2019-12-10 09:20:54
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . I'm wondering if there is a defined standard for what the default action is of various HTML elements. I've looked at the W3C's HTML specification and while they are very precise with what attributes can be used with elements (and also some behavioural stuff such as exactly what gets included with form submission)