Carl Eugen Hoyos: > Am Mi., 6. Nov. 2019 um 13:18 Uhr schrieb Andreas Rheinhardt > <andreas.rheinha...@gmail.com>: >> >> Introduced in ed3c317d. >> >> Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@gmail.com> >> --- >> fftools/ffmpeg_opt.c | 6 ++++-- >> 1 file changed, 4 insertions(+), 2 deletions(-) >> >> diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c >> index af9a9a6acb..f4ccf3f65e 100644 >> --- a/fftools/ffmpeg_opt.c >> +++ b/fftools/ffmpeg_opt.c >> @@ -3008,9 +3008,10 @@ static int opt_old2new(void *optctx, const char *opt, >> const char *arg) >> { >> OptionsContext *o = optctx; >> char *s = av_asprintf("%s:%c", opt + 1, *opt); >> + int ret; > > Shouldn't the new declarations be above the call to av_asprintf()? > > Carl Eugen
It is completely legal to perform an initialization via function call in the middle of the declarations. I just reread the (relevant part of) the standard and here comes the relevant language-lawyer-stuff. The source of the ban on "mixed declarations and code" in C90 is the syntax of compound statements (square brackets are used to denote optional parts): compound-statement: { [declaration_list] [statement-list] } declaration-list declaration declaration-list declaration statement-list statement statement-list statement And the important parts of declaration are declarator = initializer and initializer assignment-expression ... The syntax of assignment-expression is this: assignment-expression: conditional-expression unary-expression assignment-operator assignment-expression Now the assignment-expression isn't what one might think: the "=" immediately following the declarator is already used and is therefore not part of it, so that the first form of assignment-expression is used. Now comes a series of types of expression that have two forms: One that one would expect from common usage and a passthrough form. E.g. here is the syntax for conditional-expression: conditional-expression: logical-OR-expression logical-OR-expression ? expression : conditional-expression Of course the first form is used here. Via passthrough every logical-OR-expression is a logical-AND-expression is an inclusive-OR-expression is an exclusive-OR-expression is an AND-expression is an equality-expression is a relational-expression is a shift-expression is an additive-expression is a multiplicative-expression is a cast-expression is a unary-expression is a postfix-expression. And postfix-expressions have a function-call form. - Andreas _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".