结构成员初始化表达式之间是否存在序列点?
例如,是否明确定义下面的代码将始终打印“a,b”?
#include <stdio.h>
typedef struct {
char *bytes;
int position;
int length;
} Stream;
typedef struct {
char a;
char b;
} Pair;
char streamgetc(Stream *stream) {
return (stream->position < stream->length) ? stream->bytes[stream->position++] : 0;
}
int main(void) {
Stream stream = {.bytes = "abc", .position = 0, .length = 3};
Pair pair = {.a = streamgetc(&stream), .b = streamgetc(&stream)};
printf("%c, %c\n", pair.a, pair.b);
return 0;
}