Questions tagged [c11]

C11 is the informal name of an older standard version (ISO/IEC 9899:2011) of the C programming language.

Important Note: All C related questions, shall be tagged as , and then as a complement, each should specify the version of the standard it is using. In case of C11, this complement should be the tag.

Detection

A standard macro __STDC_VERSION__ is defined with the value 201112L to indicate that C11 support is available. See corr 1:2012.

Some of the changes since :

  • _Alignas specifier (and optionally the alignas macro)
  • _Alignof operator (and optionally the alignof macro)
  • _Noreturn function specifier (and optionally the noreturn macro)
  • _Generic keyword
  • _Static_assert keyword (and optionally the static_assert macro)
  • _Thread_local storage-class specifier (and optionally the thread_local macro)
  • _Atomic type qualifier
  • _Complex and _Imaginary keywords (and optionally the complex and imaginary macros)
  • once_flag, cnd_t, mtx_t, thrd_t, thrd_start_t, tss_t and tss_dtor_t types
  • char16_t and char32_t types
  • anonymous struct and union support
  • aligned_alloc function
  • quick_exit function
  • gets_s function in much-rejected optional Annex K (see ) as an alternative to the removed gets

More Info:

875 questions
-5
votes
0 answers

fgets() chokes when encountering double forward slashes

I am using fgets() to parse a text file that contains hashed passwords (brypt). This hash contains a few characters additional to alphanumeric, but to my knowledge no special characters in C. My problem is that fgets() unexpectedly chokes when…
-5
votes
1 answer

Is it legal to write ptr = &i; in C?

I have compiled following code on GCC using gcc prog.c -Wall -Wextra -pedantic -std=gnu11 command. It's does not generate any warning or error. Code: #include #include int main() { int i = 10; int *ptr = malloc(1); …
msc
  • 33,420
  • 29
  • 119
  • 214
-5
votes
1 answer

Using secure print function in C

I'm a netbeans user, I'm trying to change printf with the secure printf_s function but it didn't work. the editor is not able to figure it out ? the same for scanf_s. I know it's a part of C11, everything is up to date. what's wrong ?
Focus
  • 117
  • 9
-6
votes
1 answer

why this program compiles fine in C11 but not in C99?

Consider following program: (See live demo here) . #include struct Test { int a; }; typedef struct Test t; typedef struct Test t; int main() { t T={9}; printf("%d",T.a); } The program compiles fine in C11 compiler but fails in…
Destructor
  • 14,123
  • 11
  • 61
  • 126
-8
votes
3 answers

Why C standards contain many unsafe functions, which are useless?

Why C standards contain many unsafe functions, which are useless (in good programs them don't use) and harmful, for example getchar? Why C standard doesn't contain instead of them the useful functions, for example getch, and getche? It is only one…
Andrey Bushman
  • 11,712
  • 17
  • 87
  • 182
1 2 3
58
59