Why would you declare variables in the middle of defining a function?

后端 未结 2 1799
鱼传尺愫
鱼传尺愫 2021-01-29 02:49

I have to modify the code for the G722 codec made by the ITU at work.

I contains realy funky function definitions like this one :

    int 
    main (argc         


        
2条回答
  •  情深已故
    2021-01-29 03:42

    I found the answer by googling "Old C Style Declaration" like it was suggested in comments.

    The answer is :

    The old-style function declarations and definitions use slightly different rules for declaring parameters than the syntax recommended by the ANSI C standard. First, the old-style declarations don't have a parameter list. Second, in the function definition, the parameters are listed, but their types are not declared in the parameter list. The type declarations precede the compound statement constituting the function body. The old-style syntax is obsolete and should not be used in new code. Code using the old-style syntax is still supported, however.

    This is from : http://msdn.microsoft.com/en-us/library/efx873ys.aspx

提交回复
热议问题