standards

Is the definition of “volatile” this volatile, or is GCC having some standard compliancy problems?

吃可爱长大的小学妹 提交于 2019-11-28 16:55:57
I need a function that (like SecureZeroMemory from the WinAPI) always zeros memory and doesn't get optimized away, even if the compiler thinks the memory is never going to accessed again after that. Seems like a perfect candidate for volatile. But I'm having some problems actually getting this to work with GCC. Here is an example function: void volatileZeroMemory(volatile void* ptr, unsigned long long size) { volatile unsigned char* bytePtr = (volatile unsigned char*)ptr; while (size--) { *bytePtr++ = 0; } } Simple enough. But the code that GCC actually generates if you call it varies wildly

Is there a standard C++ grammar?

浪尽此生 提交于 2019-11-28 16:52:27
Does the standard specify the official C++ grammar? I searched, but did not find it anywhere. Also, I wish to read a bit about C++ grammar in detail, like which category of grammars it falls in, etc. Any links pointing me in the right direction would be helpful. By category, I mean taken from here . James McNellis Yes, it does. The grammar is described in detail throughout the standard and is summarized in Appendix A: Grammar Summary (it's Appendix A in both the C++03 standard and the C++0x final committee draft). You can purchase the C++03 standard or you can download the C++0x FCD (it's

Difference between 'global' and 'static global'

孤人 提交于 2019-11-28 16:14:21
A global variable 's scope is in all the files, while a static global variable 's scope is just the file where it is declared. Why so? Where are global or static global variables stored in memory? There is some confusion, since static in C can mean two different things. One is static storage duration, and the other is internal linkage. static used as a keyword on file-scope will give the function or object it is used with internal linkage. Internal linkage for a function or object means that if you declare another function in another "file" (this is not really called "file", but rather

Best practices for consistent and comprehensive address storage in a database [closed]

岁酱吖の 提交于 2019-11-28 16:01:16
问题 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 . Are there any best practices (or even standards) to store addresses in a consistent and comprehensive way in a database ? To be more specific, I believe at this stage that there are two cases for address storage : you just need to associate an address to a person, a building or

Shell script templates [closed]

你说的曾经没有我的故事 提交于 2019-11-28 15:49:22
What would be your suggestions for a good bash/ksh script template to use as a standard for all newly created scripts? I usually start (after the #! line) with a commented-out header with a filename, synopsis, usage, return values, author(s), changelog and would fit into 80-char lines. All documentation lines I start with double-hash symbols ## so I can grep for them easily and local var names are prepended with "__". Any other best practices? Tips? Naming conventions? What about return codes? Comments on version control : we use SVN all right, but another dept in the enterprise has a separate

Proper URL forming with Query String and Anchor Hashtag

爱⌒轻易说出口 提交于 2019-11-28 15:42:58
问题 When both a query string and anchor tag (hash tag) are visible in a URL, what is the proper order for them to appear? http://www.whatever.com?var=val#anchor or http://www.whatever.com#anchor?var=val Is there any documentation on this? update: The URLs are being handled by Wordpress / PHP 回答1: ?var=var#hash everything after # is client side. Also, look into url rewriting to get rid of ugly ?var=var 回答2: ? should come before the # as noted in RFC 3986: relative-ref = relative-part [ "?" query ]

Correct way to initialize HashMap and can HashMap hold different value types?

余生长醉 提交于 2019-11-28 15:19:20
So I have two questions about HashMap s in Java: What is the correct way to initialize a HashMap ? I think it might be best in my situation to use: HashMap x = new HashMap(); But Eclipse keeps suggesting that I use: HashMap<something, something> map = new HashMap(); Which is better? Can a HashMap hold different types of objects/data types as values? For example, would this work and be OK: map.put("one", 1); map.put("two", {1, 2}); map.put("three", "hello"); In the first put() , I want an int as a value, in the second an int[] , and third a string. Is this okay to do in Java with HashMap s?

Coding Style Standards for Android

我与影子孤独终老i 提交于 2019-11-28 15:11:36
I would like to know if there is some standard code styling for Android(maybe a book?) (styling XML , Java programming , file naming , etc...) inazaruk There is a good description of code style rules here . If you want to enforce this rules without remembering all of them, and you are using eclipse then you can use formatting rules provided by Android team: android-formatting.xml . Just import it into eclipse using Preferences->Java->Code Style->Formatter, click Import. There is a ton of information available here: http://source.android.com/source/code-style.html @inazaruk: The codesearch link

What are some of your most useful database standards?

廉价感情. 提交于 2019-11-28 14:57:38
I have some ideas, some that I have accumulated over time, but I really want to know what makes things go smoothly for you when modeling database: Table name matches Primary Key name and description key Schemas are by functional area Avoid composite primary keys where possible (use unique constraints) Camel Case table names and field names Do not prefix tables with tbl_, or procs with SP_ (no hungarian notation) OLTP databases should be atleast in BCNF / 4NF BenAlabaster Name similarly targetted stored procs with the same prefix, for instance if you've got 3 stored procedures for Person. That

Shell script templates [closed]

十年热恋 提交于 2019-11-28 14:57:37
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . What would be your suggestions for a good bash/ksh script template to use as a standard for all newly created scripts? I usually start (after the #! line) with a commented-out header with a filename, synopsis, usage, return values, author(s), changelog and would fit into 80-char