c11 Questions
4
Solved
I'm creating cross platform software in Visual Studio 2012 express on Windows. For obvious reasons I can't use .NET's System::Threading::Thread. I was hoping I could use the new threading features ...
Spastic asked 28/2, 2013 at 17:37
1
Context: https://stackoverflow.com/a/39707410/1778275 :
If the floating point type used a base 10 presentation, LDBL_DIG and LDBL_DECIMAL_DIG would have the same value.
Question: why base-2 leads...
Flexile asked 5/10, 2021 at 11:28
2
Solved
I have problem with interpretation of C standard, the latest draft taken from
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2454.pdf.
Standard evaluation
The standard defines pragma STD FENV_...
4
Solved
atomic_flag_test_and_set Yes!
atomic_flag_clear Yes!
atomic_flag_test_and_clear nope
atomic_flag_set nope
If you wanted to do something like set a flag on a event in some context, and in some oth...
Nunez asked 2/2, 2024 at 19:15
7
Using both gcc with -std=c11 and g++ with -std=c++14.
E.g. for a file named src/dir/Hello.cxx it should expand to something like e.g.:
const char basename[] = "Hello";
or
const char basename[]...
1
Referring to the N1570 Committee Draft of the ISO/IEC 9899:201x Programming languages - C which dates back to April 12, 2011, there should be a function timespec_get() (see 7.27.2.5).
But MinGW gc...
1
I am running the following version of clang on a Mac OS X host:
$ clang -v
Apple LLVM version 8.1.0 (clang-802.0.42)
I have some code that uses the aligned_alloc() C11 function to allocate an al...
1
Solved
I'm sure there are a lot of buffer overflow risks in coding, many of which are addressed by standard library's "_s" safe functions. Nonetheless, I find myself confused, from time to time,...
5
Solved
The following code
#include <threads.h>
Gives me this error:
fatal error: threads.h: No such file or directory
Using the latest GCC and Clang with -std=c11.
Is C11 threading not suppor...
Swellfish asked 5/4, 2014 at 1:33
3
MSVC has its own non-standard functions _aligned_malloc, _aligned_realloc and _aligned_free.
C++17 and C11 have introduced (std::)aligned_alloc, results of which can be deallocated with free or re...
Scrapple asked 16/6, 2019 at 14:13
6
Solved
I'm making my own C compiler to try to learn as much details as possible about C. I'm now trying to understand exactly how volatile objects work.
What is confusing is that, every read access in the...
Nickolenicks asked 26/1, 2023 at 14:8
7
8
Solved
There have been a lot of questions about C11 and C11 threading, but I don't see a definitive answer anywhere:
Does any C library implement the C11 threading interface usable on GNU/Linux-like? e....
Aluminous asked 3/7, 2014 at 15:26
2
Solved
I think I'm missing something obvious here. I have code like this:
int *a = <some_address>;
int *b = <another_address>;
// ...
// desired atomic swap of addresses a and b here
int *tm...
7
Solved
When I ask to see the current version of cc I get this.
$ cc --version
cc (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the sour...
7
Solved
I have created a small application to find max number by using user-defined function with parameter. When I run it, it shows this message
Error 1 error C4996: 'scanf': This function or variable...
Inflow asked 1/6, 2015 at 15:34
3
Solved
It looks like the typeof operator is likely to be accepted into the next C standard, and I was looking to see if there was a way to leverage this to create a macro using portable ISO-C that can get...
Official asked 18/3, 2022 at 2:25
4
Solved
Microsoft extensions to C and C++:
To perform the same cast and also maintain ANSI compatibility, you can cast the function pointer
to a uintptr_t before you cast it to a data pointer:
int ( * pfu...
Eloiseelon asked 7/2, 2022 at 11:45
1
Solved
Rationale for C, Revision 5.10, April-2003:
It is invalid to convert a pointer to a function of one type to a pointer to a function of a
different type without a cast.
It seems that they wanted t...
Blueweed asked 10/1, 2022 at 14:28
5
1
Solved
I have the following code:
int add_ii(int a, int b) { return a + b; }
unsigned add_iu(int a, unsigned b) { return a + b; }
unsigned add_ui(unsigned a, int b) { return a + b; }
unsigned add_uu(unsig...
1
Solved
If sizeof(int) == sizeof(long), then is INT_MIN == LONG_MIN && INT_MAX == LONG_MAX always true?
Is there any real existing cases demonstrating "not true"?
UPD. The similar questio...
2
Solved
What does the following function signature define in C?!
#include <stdio.h>
#include <string.h>
void f(int a[const volatile static 2])
{
(void)a;
}
int main() {
int b[1];
f(b);
}
...
2
Solved
base-2: why DECIMAL_DIG - DIG == 2 or 3?
Examples:
FLT_DECIMAL_DIG - FLT_DIG == 9 - 6 == 3
DBL_DECIMAL_DIG - DBL_DIG == 17 - 15 == 2
LDBL_DECIMAL_DIG - LDBL_DIG == 21 - 18 == 3
FLT16_DECIMAL_DIG -...
Archegonium asked 5/10, 2021 at 11:36
1
Solved
I am writing code that depends on halfway ties in C (specifically c11) rounding to even. When using rint with rounding mode as FE_TONEAREST, I have not found a guarantee in the C standard that stat...
Immigrate asked 28/9, 2021 at 16:37
1 Next >
© 2022 - 2025 — McMap. All rights reserved.