c11

Compilers that support C11

北慕城南 提交于 2019-11-28 18:48:53
I was wondering if there are any compilers that support a considerable amount of the new C11 standard. Looking for features like Generic Selection etc. Any suggestions? Pelles C version 7.00 (Release Candidate is available now) http://www.smorgasbordet.com/pellesc/ Your best bet is probably Clang. See the release notes for the current release and the upcoming one . GCC 4.9 supports generic selection . It is in general bugfixing stage before release. http://gcc.gnu.org/gcc-4.9/changes.html I think Clang supports generic selection. Intel 18 supports nearly all of C11 and supported generic

Understanding the C11 type hierarchy

↘锁芯ラ 提交于 2019-11-28 18:40:56
问题 I would like to fully understand type hierarchy of the C11 language and present it graphically (a tree diagram would be perfect). The standard does not provide any figure for this issue – there are 30 points describing individual types and relations between them. I'd like to draw it. My attempt started from obtaining the ISO/IEC 9899:201x Committee Draft N1570 and extracting all the essential statements from section 6.2.5 of the document. Then, I started to rearrange the knowledge in a form

Latest changes in C11

天涯浪子 提交于 2019-11-28 17:28:15
C1x has become ISO/IEC 9899:2011 aka C11. Does anyone know what changes (if any) there are in the Standard from the April 2011 draft n1570 ? ETA: There are the Committee minutes from London (March 2011) (which should be included in n1570) here , and from Washington, DC (October 2011) here ; I suppose a list of accepted changes in the DC minutes should cover things. I just learned today that there was one (somewhat) significant change between N1570 and the final C11 standard (ISO/IEC 9899:2011 (E)). In N1570, 6.3.2p3 says: Except when it is the operand of the sizeof operator, the _Alignof

std::isfinite on MSVC

别说谁变了你拦得住时间么 提交于 2019-11-28 13:24:22
The C++11 and C11 standard define the std::isfinite function. Visual Studio 2012 doesn't seem to provide it as part of the cmath or math.h , but has amp_math.h which seems to provide this function . Is the isfinite interchangeable with std::isfinite ? The documentation doesn't talk about the behavior when called with NAN and I don't have a VS compiler to test this. As Marius has already pointed out, the isfinite from amp_math.h is to be used in C++ AMP, which is an MS extension for parallel computing on many-core architectures similar to CUDA or OpenCL. And since this function can only be used

String input using C scanf_s

三世轮回 提交于 2019-11-28 12:50:45
I've been trying to look for answer myself, but I can't find one. I want to insert a part of the programming that reads in a string like "Hello" and stores and can display it when I want, so that printf("%s", blah); produces Hello . Here's the code part that's giving me trouble char name[64]; scanf_s("%s", name); printf("Your name is %s", name); I know that printf isn't the problem; the program crashes after something is input after a prompt. Please help? From the specification of fscanf_s() in Annex K.3.5.3.2 of the ISO/IEC 9899:2011 standard: The fscanf_s function is equivalent to fscanf

Is support of Annex K in C11 required for a conforming implementation?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-28 11:23:09
While answering a question that made use of some functions ( sscanf_s and sprintf_s ) that I thought were not standard C, Daniel Fischer brought to my attention that the functions in question were defined in Annex K. I understand generally that normative means it helps define the standard. But, an annex to the C Standard has traditionally been treated as informative only. Annex K is labeled as normative in the C11 Standard. It defines "safe" functions. Does this mean a compiler that doesn't provided these functions does not conform to the C11 Standard? I only have the draft C11 Standard

Header for scanf_s function

浪尽此生 提交于 2019-11-28 10:35:36
While answering this question I compiled the code on Ideone and got this error implicit declaration of function ‘scanf_s’ [-Wimplicit-function-declaration] Isn't stdio.h is the header for scanf_s ? scanf_s is Microsoft-specific. Header is stdio.h but not in GCC. Used to Read formatted data from the standard input stream. These versions of scanf, scanf_s, _scanf_l, wscanf, _wscanf_l have security enhancements Where as Ideone uses GCC because of this only you got undefined reference to scanf_s Mostly You can found this function in windows based compilers like Visual Studio 2008 and Microsoft

Why are typedef identifiers allowed to be declared multiple times?

佐手、 提交于 2019-11-28 09:12:58
From the C99 standard, 6.7(5): A declaration specifies the interpretation and attributes of a set of identifiers. A definition of an identifier is a declaration for that identifier that: for an object, causes storage to be reserved for that object; for a function, includes the function body; for an enumeration constant or typedef name, is the (only) declaration of the identifier. If identifiers with typedef are in fact definitions, then why are they allowed to be declared more than once? Example: int main() { typedef int x; typedef int x; } Above program compiles with no errors. How is this

Is int main() { } (without “void”) valid and portable in ISO C?

走远了吗. 提交于 2019-11-28 08:12:39
The C standard specifies two forms of definition for main for a hosted implementation: int main(void) { /* ... */ } and int main(int argc, char *argv[]) { /* ... */ } It may be defined in ways that are "equivalent" to the above (for example, you can change the parameter names, replace int by a typedef name defined as int , or write char *argv[] as char **argv ). It may also be defined "in some other implementation-defined manner" -- which means that things like int main(int argc, char *argv[], char *envp) are valid if the implementation documents them. The "in some other implementation-defined

Does x86-SSE-instructions have an automatic release-acquire order?

夙愿已清 提交于 2019-11-28 07:30:13
问题 As we know from from C11-memory_order: http://en.cppreference.com/w/c/atomic/memory_order And the same from C++11-std::memory_order: http://en.cppreference.com/w/cpp/atomic/memory_order On strongly-ordered systems ( x86 , SPARC, IBM mainframe), release-acquire ordering is automatic. No additional CPU instructions are issued for this synchronization mode , only certain compiler optimizations are affected (e.g. the compiler is prohibited from moving non-atomic stores past the atomic store