3 ms·
> Compound literals are lvalues > ((struct Foo){}).x = 4; Do such lvalues have any real use?
by Croftengea 3y ago
> Compound literals are lvalues
> ((struct Foo){}).x = 4;
Do such lvalues have any real use?
- kzrdude 3y agoYou could pass them to a function where something non-null is required but you don't want to use it, like : `f(&(struct Foo){0})`
- deleted 3y ago[deleted]
- eqvinox 3y agoThe key thing about it being an lvalue is that you can take its address — you can only take the address of lvalues. Other than that, no, no real use.