Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
10 votes
1 answer
515 views

The order of bits in C11 bitfields is implementation-defined, and so is any padding in between them. This makes it difficult to access the bitfields by index at runtime, even though most ...
jpa's user avatar
  • 12.5k
3 votes
1 answer
94 views

A pointer can be safely cast to intptr_t (or uintptr_t) and back (on platforms where those types exist), but what about casting a pointer-to-intptr_t into pointer-to-pointer and using that to modify ...
njlarsson's user avatar
  • 2,540
1 vote
1 answer
198 views

I'm writing a tool in Kotlin using ANTLR4 with this nicely working grammar: Grammar for C11 by Sam Harwell The grammar works fine, my tool works. But suddenly I ran into a problem. One C source made a ...
jazz64's user avatar
  • 396
1 vote
1 answer
145 views

C11 6.3.2.3p7 says: A pointer to an object type may be converted to a pointer to a different object type. If the resulting pointer is not correctly aligned 68) for the referenced type, the behavior ...
Petr Skocik's user avatar
  • 60.6k
1 vote
2 answers
120 views

I can compile and run a program that includes <getopt.h> and uses getopt_long with keys -std=c11 --pedantic-errors. Can you explain why?
Akramat's user avatar
  • 163
2 votes
1 answer
125 views

In C11 rules of reserved identifiers are defined in the library clause (clause 7). Hence, are rules of reserved identifiers irrelevant if library is not used? Note: in C23 rules of reserved ...
pmor's user avatar
  • 6,757
4 votes
1 answer
104 views

So I've came across Jeff Preshing's wonderful blog posts on what's Acquire/Release and how they may be achieved with some CPU barriers. I've also read that SeqCst is about some total order that's ...
Not A Name's user avatar
2 votes
4 answers
171 views

Is { struct-declaration-list } in C11 (as known as { member-declaration-list } in C23) a block? The original issue: I cannot find the exact definition of the term "block" in the C standard (...
pmor's user avatar
  • 6,757
2 votes
1 answer
85 views

I was reading the paper Repairing Sequential Consistency in C/C++11 by Lahav et al and had a doubt regarding the 2+2W litmus test presented there. Under the section Semantics of SC Atomics in C11, ...
Dhwani Katagade's user avatar
6 votes
1 answer
220 views

I've read that C doesn't mandate a minimum stack size, leaving it implementation-defined. But could a conforming C compiler refuse to compile a program if it detects--say, through static analysis--...
Alphin Thomas's user avatar
1 vote
1 answer
102 views

I'm working on a delay loop in C and come across an odd case with volatile. Consider this code: void delay(unsigned int count){ volatile unsigned int timer = count; while (timer > 0){ ...
Alphin Thomas's user avatar
2 votes
2 answers
138 views

I would like to use _Generic to expand function-like macro instead of function in C: #include <stdio.h> #define VAL_V(X) X #define VAL_P(X) *X #define VAL(X) _Generic((X), int: VAL_V, int *: ...
MaPo's user avatar
  • 887
1 vote
1 answer
158 views

My application is written in C99 (or rather GNU99, and I wouldn't mind going to GNU11), and I'd like to require trailing commas in structure initializers. Does GCC have a warning (turned into error ...
Radim Vansa's user avatar
  • 5,926
0 votes
4 answers
140 views

Is newNode->next = NULL; an undefined behavior in this case? struct node { int value; _Atomic(struct node*) next; }; //at the initialization stage struct node* newNode = malloc(sizeof(struct ...
Mr.nerd3345678's user avatar
3 votes
1 answer
189 views

With ISO C99 onward we have a few macros (or constants) that help understanding how some math errors (see <math.h> related) are signaled. However, to me it looks like they haven't been ...
LuC's user avatar
  • 433

15 30 50 per page
1
2 3 4 5
62