standards

Column type and size for international country subdivisions (states, provinces, territories etc)

ε祈祈猫儿з 提交于 2019-12-10 06:28:41
问题 I apologize if this is a duplication. What column standardization would you use for storing international country subdivision data? For example, if it was just US and Canada I believe all subdivisions have a 2-character abbreviation... which might lend to a Char(2) This cannot possibly be sustainable internationally lest we presume there are only 1296 (A-Z, 0-9) subdivisions. I've been unsuccessful locating an ISO list of these or even an indication of how to store them. That's fine, I don't

Block scope linkage C standard

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-10 04:37:05
问题 The following identifiers have no linkage: an identifier declared to be anything other than an object or a function; an identifier declared to be a function parameter; a block scope identifier for an object declared without the storage-class specifier extern . { static int a; //no linkage } For an identifier declared with the storage-class specifier extern in a scope in which a prior declaration of that identifier is visible, if the prior declaration specifies internal or external linkage,

Is this legal C/C++? `int* p = (int[]) {1,2,3} ;`

元气小坏坏 提交于 2019-12-10 03:26:43
问题 This answer of mine generated some comments claiming that the following construct is not legal C/C++: void f (int* a) ; f ((int[]){1,2,3,4,0}) ; (see this ideone link for a full program). But we weren't able to resolve the issue. Can anybody shed any light on this? What do the various standards have to say? 回答1: It's valid C99 as far as I can tell - that's passing a compound literal. The C99 standard has this as an example (§6.5.2.5/9): EXAMPLE 1 The file scope definition int *p = (int []){2,

Are there any NoSQL standards emerging? [closed]

老子叫甜甜 提交于 2019-12-10 03:02:55
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . As with most new technologies after a while a standard emerges. Is there anything cooking for NoSQL? 回答1: The whole point of NoSQL is

Implicit conversion operator priority

限于喜欢 提交于 2019-12-10 01:50:21
问题 In the following piece of code (live on coliru): #include <iostream> #include <string> int main() { struct S { operator bool () const { return false; } operator std::string () const { return "false"; } } s; std::cout << s << "\n"; // outputs 0 } How does the compiler choose to pick the implicit conversion to bool over std::string ? My hypothesis is that in this case, it might be purely the order of declaration of the different flavours of std::basic_ostream::operator<<, but is it all? Does

atoi is a standard function. But itoa is not. Why?

删除回忆录丶 提交于 2019-12-10 01:50:11
问题 Why this distinction? I've landed up with terrible problems, assuming itoa to be in stdlib.h and finally ending up with linking a custom version of itoa with a different prototype and thus producing some crazy errors. So, why isn't itoa not a standard function? What's wrong with it? And why is the standard partial towards its twin brother atoi ? 回答1: No itoa has ever been standardised so to add it to the standard you would need a compelling reason and a good interface to add it. Most itoa

Should I prevent password autocomplete?

本小妞迷上赌 提交于 2019-12-09 19:15:41
问题 There are lots of replies here on how to prevent password form element autocomplete. My question is should we? According to the UK government; forcing password resets (something we're often asked to do by clients) describes a net-loss in security and it's actively discouraged. According to Mozilla; forcing password autocomplete off also suggests a net-loss in security . The UK .gov website doesn't mention this particular practice. My question: Should I attempt to prevent password autocomplete

websocket for binary transfer of data & decode

試著忘記壹切 提交于 2019-12-09 15:47:08
问题 I was reading through the specification and many examples about usage of websockets. Almost all of them talk about UTF-8 or ascii message transfer using websockets. The latest Hybi websocket spec requested support for binary transfer. REQ 6 in hybi spec Also i read somewhere that chrome supports hybi. But latest release Chrome 7.0 works only when draft-hixie is selected in pywebsocket config. Does any browser have support for hybi spec? Even if it is dev, its ok. 回答1: It may be a while before

Purpose of boost::checked_delete

本秂侑毒 提交于 2019-12-09 14:40:27
问题 I don't understand the purpose of boost::checked_delete. The documentation says: The C++ Standard allows, in 5.3.5/5, pointers to incomplete class types to be deleted with a delete-expression. When the class has a non-trivial destructor, or a class-specific operator delete, the behavior is undefined. Some compilers issue a warning when an incomplete type is deleted, but unfortunately, not all do, and programmers sometimes ignore or disable warnings. The supplied function and class templates

`short int` vs `int`

时光总嘲笑我的痴心妄想 提交于 2019-12-09 14:34:47
问题 Should I bother using short int instead of int ? Is there any useful difference? Any pitfalls? 回答1: What Ben said. You will actually create less efficient code since all the registers need to strip out the upper bits whenever any comparisons are done. Unless you need to save memory because you have tons of them, use the native integer size. That's what int is for. EDIT: Didn't even see your sub-question about const. Using const on intrinsic types (int, float) is useless, but any pointers