M
markn
Running some code through static analysis, I noticed that gcc will
generate a warning if a function returns an aggregate, controlled with
this flag (from the gcc manual):
-Waggregate-return
Warn if any functions that return structures or unions are defined
or called. (In languages where you can return an array, this also
elicits a warning.)
Easy enough to disregard, but I'm trying to understand the rationale.
Were aggregate returns not allowed in K&R? Is there some other good
reason for this warning?
I guess you might want to know about this if you were writing a
library that returns values to some other language, but that seems
like kind of a weak reason for a warning message. If you were using
that justification, you could end up generating warnings for just
about any otherwise normal behavior.
Thanks.
|
| Mark Nelson - http://marknelson.us
|
generate a warning if a function returns an aggregate, controlled with
this flag (from the gcc manual):
-Waggregate-return
Warn if any functions that return structures or unions are defined
or called. (In languages where you can return an array, this also
elicits a warning.)
Easy enough to disregard, but I'm trying to understand the rationale.
Were aggregate returns not allowed in K&R? Is there some other good
reason for this warning?
I guess you might want to know about this if you were writing a
library that returns values to some other language, but that seems
like kind of a weak reason for a warning message. If you were using
that justification, you could end up generating warnings for just
about any otherwise normal behavior.
Thanks.
|
| Mark Nelson - http://marknelson.us
|