Click here to Skip to main content
15,890,579 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
What is this "technique" called with the type/variable assignment nestled between the function header and the body? Why would someone do this? thanks

C++
void MyFunction (void) //function header

  int i;     
 double d;

 {
 
// body

}
Posted
Updated 25-Feb-15 15:22pm
v2

1 solution

Very very old style C. Pre-ANSI, K&R style.


Here's what DEC C V6.0-001 on OpenVMS Alpha V7.2 has to say about it:

"
int
^
The function "main" is defined using the old style K&R syntax. The ANSI C Standard has marked this syntax as obsolescent, and it is
not supported in C++. Consider using the new ANSI C prototype syntax.
at line number 4 in file MY$ROOT:[000000]TEST.C;5
Description: The function uses an old style function definition. Digital recommends that old style function definitions be replaced
by prototype-format definitions.
User Action: Recode the function definition to use the recommended prototype-format definition.
"
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 25-Feb-15 22:43pm    
5ed.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900