D
/dev/phaeton
In K&R2, function definitions in a program were preceded by a function
prototype, i.e.:
int my_function(int variable1, int variable2);
Then somewhere down the line is the actual definition of the function
itself:
int my_function(int variable1, int variable2)
{
do;
some;
stuff;
return (some_value);
}
However, I've noticed that if I omit the function prototype, the program
compiles (with gcc 4.6.x at least) and runs just fine. Is this
something that's now acceptable in ANSI standards since K&R2 was
printed? Or is this 'compiler forgiveness'- letting me do something I
probably shouldn't?
Thanks.
-J
prototype, i.e.:
int my_function(int variable1, int variable2);
Then somewhere down the line is the actual definition of the function
itself:
int my_function(int variable1, int variable2)
{
do;
some;
stuff;
return (some_value);
}
However, I've noticed that if I omit the function prototype, the program
compiles (with gcc 4.6.x at least) and runs just fine. Is this
something that's now acceptable in ANSI standards since K&R2 was
printed? Or is this 'compiler forgiveness'- letting me do something I
probably shouldn't?
Thanks.
-J