standards

initialization of anonymous structures or unions in C1X

柔情痞子 提交于 2019-11-28 23:14:19
I have the following question: How are anonymous structures (or unions) properly initialized according to the current C1X draft ? Is this legal: struct foo { int a; struct { int i; int j; }; int b; }; struct foo f = { 1, 2, 3, 4 }; struct foo g = { 1, { 2 }, 3 }; In GCC, g.j == 0 and g.b == 3 , while in tcc g.j == 3 and g.b == 0 . The current draft says: "[...] unnamed members of objects of structure and union type do not participate in initialization. Unnamed members of structure objects have indeterminate value even after initialization.". Can this be really true? Isn't struct foo h = { 0 };

Where can I get free specifications of JPEG/JFIF/EXIF/etc?

谁都会走 提交于 2019-11-28 22:56:28
问题 I want to make a tool for myself (and maybe others if it comes out good) for low level inspection/modification of JPEG files. Sort of like TweakPNG, but for JPEGs. So far I haven't found any tool that does this. In order to do that I need to read all the relevant specifications. Unfortunately the official ones are pretty costly, so I'm looking for alternate sources. Is there anything you can recommend which covers as much ground as possible? 回答1: To answer my own question: Part 1 can be

JSON standard - floating point numbers

纵饮孤独 提交于 2019-11-28 22:23:23
I am wondering whether the following floating point notation is a valid JSON notation: "result":{"base_fee":1e-005} or should the exponent notation be replaced with a decimal notation? It is valid according to the format available at json.org as numbers can optionally have a base 10 exponent denoted by an E, uppercase or lowercase, an optional plus or minus, and one or more digits. It's perfectly valid, according to RFC 4627 RFC 7159 *: The representation of numbers is similar to that used in most programming languages. A number contains an integer component that may be prefixed with an

How does the standards committee indicate the status of a paper under consideration?

与世无争的帅哥 提交于 2019-11-28 21:26:25
Does the C++ standards committee provide (on the open standard site or elsewhere) any indicatation of the status of the papers under consideration and indexed on the open-standards site? I am referring to the individual "papers" indicating potential changes to the standard, with associated discussion, as per the example below; I am not referring to the (published or draft) standard as a whole . For instance, how can I determine whether N3922 has been accepted or rejected? Shafik Yaghmour For this particular case, we can guess this is an Evolution Working Group( EWG ) issue from the Background

ISO Standard Street Addresses?

你说的曾经没有我的故事 提交于 2019-11-28 21:17:20
Is there an ISO standard address format? I can't seem to find one, and I'd like to know for object- and database-design purposes. (One interesting document that shows a bunch of formats is this: http://www.bitboost.com/ref/international-address-formats.html , but it's insane!) Jonathan Leffler No; each country defines its own standard. There have been a number of questions about this in times past, including: Best practices for storing postal addresses in an RDBMS Is there a common street address database design for all addresses of the world The second of those itself has references to a

How to Implement URL Routing in PHP

一曲冷凌霜 提交于 2019-11-28 20:55:43
How to implement URL Routing in PHP. Vinko Vrsalovic If you use Apache you can do the URL routing via mod_rewrite. Small example: RewriteEngine On RewriteRule ^(dir1)/?(path2)? main.php?dir=$1&path=$2 That'll have any request like http://yoursite.com/dir1/path1 served by http://yoursite.com/main.php?dir=dir1&path=path2 More examples here . The other alternative have every request redirect to a single php file RewriteEngine On RewriteRule (.*) main.php?request=$1 and then to do it in code, where you can use a similar approach , by having a set of regular expressions that are matched by some

What are the Constraints in Standard C?

可紊 提交于 2019-11-28 20:19:39
C standards talk about constraints , e. g. ISO/IEC 9899:201x defines the term constraint restriction, either syntactic or semantic, by which the exposition of language elements is to be interpreted and says in chapter Conformance If a ‘‘shall’’ or ‘‘shall not’’ requirement that appears outside of a constraint or runtime-constraint is violated, the behavior is undefined. In chapter Environment , Subsection Diagnostics it is said A conforming implementation shall produce at least one diagnostic message (identified in an implementation-defined manner) if a preprocessing translation unit or

Using ssize_t vs int

只谈情不闲聊 提交于 2019-11-28 20:14:54
Code I've got a function which I can write in one of the four possible ways: int do_or_die(int retval); int do_or_die(ssize_t retval); ssize_t do_or_die(int t retval); ssize_t do_or_die(ssize_t retval); And then it will be called with both of these ways for library functions: written = do_or_die(write(...)); // POSIX write returns ssize_t printed = do_or_die(printf(...)); // printf returns int Questions Which prototype should I use? What types should I give to written and printed ? I want to have the most robust and standard code, while still having just one do_or_die function. I am using C99

Does the C++ standard specify anything on the representation of floating point numbers?

妖精的绣舞 提交于 2019-11-28 20:09:17
For types T for which std::is_floating_point<T>::value is true , does the C++ standard specify anything on the way that T should be implemented? For example, does T has even to follow a sign/mantissa/exponent representation? Or can it be completely arbitrary? From N3337: [basic.fundamental/8]: There are three floating point types: float, double, and long double. The type double provides at least as much precision as float, and the type long double provides at least as much precision as double. The set of values of the type float is a subset of the set of values of the type double; the set of

Build issue with MSVS 2010 and the C++ standard

巧了我就是萌 提交于 2019-11-28 19:23:21
问题 I'm trying to build, using msvs 2010 the project found at the following git: https://github.com/Joonhwan/exprtk The problem is when I comment out the line 48 '#define exprtk_lean_and_mean' in exprtk.hpp file, I get the following compiler error: Error 1 error C1128: number of sections exceeded object file format limit : compile with /bigobj Googling the error, seems to indicate the the compiled translation unit has compiled to something larger than an arbitariy limit, and adding 'bigobj' to