All Questions
3
questions
2
votes
1
answer
59
views
Using previously set fields when initializing structure with compound literals
What is the expected behavior of referring to previously set fields, when declaring initial values for a struct using compound literal: Specifically is it ok to: struct foo v = { .v1 = ..., .v2 = .v1+...
4
votes
2
answers
118
views
Function pointer compatibility between single pointer and empty parameter lists
I've been reading about function pointer compatibility, but have not found the following scenario documented as being acceptable (below).
With this code, it is allowed (without warnings) to call a ...
3
votes
2
answers
243
views
Initialize block-scope static const variable with pointer to compound literal?
The following code is rejected by GCC and Clang (godbolt link):
struct thing;
typedef enum {
THING_TYPE_A,
THING_TYPE_B,
} thing_type_t;
typedef struct thing_a {
int i;
} thing_a_t;
typedef ...