Listmates,
First post, and more of a curiosity than a problem. Years ago I worked
extensively with c, fortran, etc. (late '80s, early 90s). I do my own office
infrastructure/networking/groupware, etc. all with linux and open source
software. Occasionally that requires me to dust off my programming tools to
tweak this or that to work in my setting. Most recently a bit of c with the
mysql connector. In doing so I have noticed one big change to the way source
files are now formatted.
When I grew up doing this your source files and functions would
normally be
laid out in this order:
#include <headerfile.h>
void function (); // function headers defs
int *function ();
int main () {
do something;
return 0;
}
void function () {
stuff;
}
int *function () {
stuff;
}
Now I see through much of the glibc documentation and other sources a
layout
like this:
#include <headerfile.h>
void
function ()
{
stuff;
}
int *
function ()
{
stuff;
}
int
main ()
{
do something;
return 0;
}
And, yes, I know it doesn't matter to the compiler, but as I said I was
curious. Has there been some type of recommended standard for doing it in this
way, or is it just more of a some people like chocolate ice cream versus
vanilla issue? In the olden days, IIRC, the logic was that you wanted to see
the most important part of your code up top -- the main function, without
having to wade through all the function bodies before you got to it. With the
new layout, you don't have to worry about an additional function def up top
with eliminates the chance of typos and makes changes easier. So I see the
benefits of both.
Also, if this is some type of flame war issue like vi/emacs, I
apologize in
advance, I am not aware of its sensitivity, I'm just curious and like to
follow the "recommended" standard in case somebody has to read my code in the
future. Thanks.
All I'm looking for is either a (yep there was a new recommendation,
here's
the link) or a (it's a chocolate or vanilla thing).
--
David C. Rankin, J.D.,P.E.
Rankin Law Firm, PLLC
510 Ochiltree Street
Nacogdoches, Texas 75961
Telephone: (936) 715-9333
Facsimile: (936) 715-9339
www.rankinlawfirm.com