E
Earl Higgins
The company where I work as a Senior Software Engineer is currently
revamping their (1991 era) "Programming and Style Guidelines", and I'm
on the committee. The company, in business for over 20 years, writes
medical software, which must ultimately pass FDA approval and ISO 9000
certification. The product the document applies to is a large system,
(just over 3 million lines of code) running on a variety of platforms
(all Unix-ish), and over 99% written in C (no C++), compiled with gcc.
There's alot wrong with the document, and there's alot of inertia in
our Engineering Department to keep committing the same mistakes we've
been doing since day one (e.g. casting return value from malloc), and
even to go so far as to mandate the use of these constructs.
I'd like to go into this project well-informed about a couple of
specific topics, and was wondering if some of the veterans of this
group could tell me whether their sympathies would lie for, or against
each of the following actual passages from the document, and why:
"C program file names must be unique within the first 14 characters.
This is a limit imposed by at least one version of UNIX where the ...
application is supported."
"Main programs should be at the start of the file. Higher level
subroutines should be below that, and the lowest level detail
functions should be at the end of the file." and "All C functions
should have function prototypes available in a header file."
"Avoid calling system commands with the "system()" or "popen()"
subroutines as they have a very high overhead."
"Each function starts with. a form feed (Control L) enclosed in a
comment so that each function starts on a new page, i.e.; /* ^L */."
Additionally, an email has been sent to the committee from the
organizing manager hinting that he favors adding the following (among
other things):
"we should explicitly ban the ternary operator"
"Please do not create structures that contain "char foo[12]" instead
create "char *foo" when the string is to be used in structure ... {and
use dynamic memory allocation instead}."
Any thoughts would be appreciated!
Earl Higgins
revamping their (1991 era) "Programming and Style Guidelines", and I'm
on the committee. The company, in business for over 20 years, writes
medical software, which must ultimately pass FDA approval and ISO 9000
certification. The product the document applies to is a large system,
(just over 3 million lines of code) running on a variety of platforms
(all Unix-ish), and over 99% written in C (no C++), compiled with gcc.
There's alot wrong with the document, and there's alot of inertia in
our Engineering Department to keep committing the same mistakes we've
been doing since day one (e.g. casting return value from malloc), and
even to go so far as to mandate the use of these constructs.
I'd like to go into this project well-informed about a couple of
specific topics, and was wondering if some of the veterans of this
group could tell me whether their sympathies would lie for, or against
each of the following actual passages from the document, and why:
"C program file names must be unique within the first 14 characters.
This is a limit imposed by at least one version of UNIX where the ...
application is supported."
"Main programs should be at the start of the file. Higher level
subroutines should be below that, and the lowest level detail
functions should be at the end of the file." and "All C functions
should have function prototypes available in a header file."
"Avoid calling system commands with the "system()" or "popen()"
subroutines as they have a very high overhead."
"Each function starts with. a form feed (Control L) enclosed in a
comment so that each function starts on a new page, i.e.; /* ^L */."
Additionally, an email has been sent to the committee from the
organizing manager hinting that he favors adding the following (among
other things):
"we should explicitly ban the ternary operator"
"Please do not create structures that contain "char foo[12]" instead
create "char *foo" when the string is to be used in structure ... {and
use dynamic memory allocation instead}."
Any thoughts would be appreciated!
Earl Higgins