sdcc crashes when compiling from standard input.
Only the second expression works.
Do you mean like this ? int arr[] = (int[]){1,2,3,4,5}; Upd: This expression don't work on stm8.
Do you mean like this ? int arr[] = (int[]){1,2,3,4,5};
Do you mean like this ? int[] arr = (int[]){1,2,3,4,5};
This is a known way to fix the bug, but it prevents the feature from being used in macros. #define CREATE_WRAPPER(literal) ((wrapper){.text = literal}) typedef struct {const char* text;} wrapper; void use_value(wrapper v); void main() { wrapper value = CREATE_WRAPPER("must be created"); use_value(value); use_value( CREATE_WRAPPER("created")); } and more case typedef struct {const char* text;} wrapper; typedef struct {int a; wrapper* b; float c;} foo; void usage() { foo f = {.a=1, .b = &((wrapper){.text...
This is a known way to fix the bug, but it prevents the feature from being used in macros. #define CREATE_WRAPPER(literal) ((wrapper){.text = literal}) typedef struct {const char* text;} wrapper; void use_value(wrapper v); void main() { wrapper value = CREATE_WRAPPER("must be created"); use_value(value); use_value( CREATE_WRAPPER("created")); } and more case typedef struct {const char* text;} wrapper; typedef struct {int a; wrapper b; float c;} foo; void usage() { foo f = {.a=1, .b = (wrapper){.text...
This is a known way to fix the bug, but it prevents the feature from being used in macros. #define CREATE_WRAPPER(literal) ((wrapper){.text = "not created constant"}) typedef struct {const char* text;} wrapper; void use_value(wrapper v); void main() { wrapper value = CREATE_WRAPPER("must be created"); use_value(value); use_value( CREATE_WRAPPER("created")); } and more case typedef struct {const char* text;} wrapper; typedef struct {int a; wrapper b; float c;} foo; void usage() { foo f = {.a=1, .b...