please me question of "legitimacy".
assuming foo() function returning structure, officially acceptable assign member of structure directly variable, example
x = foo().member
both gnu-c complier , embedded c compiler (keil) accept without grumbles legitimate according official c standard or relaxed attitude of these particular compilers? if it's legit, has been legit or recent development?
here's example compiles , runs ok:
typedef struct { int a; int b; } footype; footype testfoo(void) { footype n; n.a = 1; n.b = 2; return n; } int main() { printf("\ntest = %d\n", testfoo().a); return 0; }
yes, standard c syntax.
Comments
Post a Comment