Skip to main content
Filter by
Sorted by
Tagged with
2 votes
2 answers
177 views

For the purpose of debugging, our project is sometimes using global volatile variables: volatile struct { uintptr_t last_read = 0; uintptr_t last_write = 0; size_t reads = 0; size_t ...
Dominik Kaszewski's user avatar
1 vote
1 answer
74 views

I'm struggling to understand this section on bitfields of the C language specification (6.7.2.1.11): An implementation may allocate any addressable storage unit large enough to hold a bit-field. If ...
Maldus's user avatar
  • 11.9k
0 votes
1 answer
82 views

The Fenwick tree data structure requires a member function read. For a index idx, read must compute several indices idx[0], idx[1], idx[2], ..., idx[last]. Each idx[i] will be the value that results ...
mbang's user avatar
  • 865
0 votes
1 answer
234 views

Reading https://en.cppreference.com/w/cpp/language/bit_field, are the following conclusions correct? whether adjacent bit-fields have no padding in between is implementation-defined (this reads ...
wimalopaan's user avatar
  • 5,552
1 vote
1 answer
150 views

In the MISRA C document there are explanations about "Source References" and there is a table whose rows are: Unspecified, Undefined, Implementation-defined, Locale-specific, MISRA ...
Reza Bodaghi's user avatar
2 votes
1 answer
185 views

In ISO standard C, my understanding is that there is nothing that actually nails down the the representation of a _Bool, but it does say: "_Bool is large enough to hold the values 0 and 1" &...
Jesse's user avatar
  • 51
1 vote
1 answer
68 views

Case A: C11, 6.6 Constant expressions, Semantics, 5: If a floating expression is evaluated in the translation environment, the arithmetic range and precision shall be at least as great as if the ...
pmor's user avatar
  • 6,757
6 votes
4 answers
1k views

#include <limits.h> int main(){ int a = UINT_MAX; return 0; } I this UB or implementation defined? Links saying its UB https://www.gnu.org/software/autoconf/manual/autoconf-2.63/html_node/...
Dan's user avatar
  • 3,068
32 votes
2 answers
2k views

Yesterday, someone showed me this code: #include <stdio.h> int main(void) { unsigned long foo = 506097522914230528; for (int i = 0; i < sizeof(unsigned long); ++i) printf(&...
mediocrevegetable1's user avatar
0 votes
0 answers
77 views

Why it (seems that it) is a general practice for C compiler vendors to not provide to the end users an additional conformance documentation about implementation-defined behavior regarding «other forms ...
pmor's user avatar
  • 6,757
97 votes
6 answers
9k views

I saw the below code in this Quora post: #include <stdio.h> struct mystruct { int enabled:1; }; int main() { struct mystruct s; s.enabled = 1; if(s.enabled == 1) printf("Is enabled\n"...
iammilind's user avatar
  • 70.5k
3 votes
1 answer
115 views

I found here that lambdas are captured by value. This means that if an algorithm internally uses a second algorithm which accepts the lambda by value, any mutable state of the lambda will not be ...
Jonathan Mee's user avatar
  • 39.1k
5 votes
1 answer
2k views

Why is something as fundamental as the number of bits in a byte, been kept implementation-defined by C standard? Are there examples where this could be useful? from C99 , 3.6 ( available here link) ...
physicist's user avatar
  • 934
476 votes
10 answers
108k views

I posted a question with my code whose only #include directive was the following: #include <bits/stdc++.h> My teacher told me to do this, but in the comments section I was informed that I ...
Lightness Races in Orbit's user avatar
141 votes
4 answers
126k views

I can't find an answer in the standard documentation. Does the C++ language standard require sizeof(bool) to always be 1 (for 1 byte), or is this size implementation-defined?
0xbadf00d's user avatar
  • 18.4k