Work Testimony

"Robert J. Brown" (rj@ELI.WARIAT.ORG)
Thu, 11 Apr 1996 13:12:12 -0500


>>>>> "Richard" == Richard Masoner <richardm@cd.com> writes:

    Richard> I type type type, compile -- NOT A SINGLE ERROR!!!!  For
    Richard> those of you who have done any programming, you know how
    Richard> incredible that is!  I did have a few warnings about
    Richard> assigning "const char * to u_char *" and stuff like that,
    Richard> but a few typecasts fixed that right up.

HACK! HACK! HACK!!!

Bro. Richard, what you described was an acceptable field fix, but it
needs to be straightened out "back at the ranch".  I assume the code
was either ANSI C or C++.  The type system is there to prevent errors
at runtime by catching them at compile time.  The typecast is a VERY
BAD THING, and should be avoided at almost any cost, as it disables
the type checking mechanisms built into the compiler.

I know you were under the gun, so what you did was OK, but if that
code needs to go under CM (I assume it does) then it should have to
pass a peer review.  During that review, you should have to justify
that typecast as being absolutely necessary, and a manager should have
to sign off on the decesion to allow the typecast to remain in the
source code.

Most of these kind of typecasts can be avioded by taking a careful
look at what is happening.  When a cast seems unavoidable, you should
always consider using a union instead of a cast.

Just my seasoned 2 cents worth :-)

-- 
-----------  "...  And the men went up and viewed Ai."  [Jos 7:2]  -----------
Robert Jay Brown III  rj@eli.wariat.org  http://eli.wariat.org  1 847 705-0370
Elijah Laboratories Inc;  759 Independence Drive;  Suite 5;  Palatine IL 60074
-----  M o d e l i n g   t h e   M e t h o d s   o f   t h e   M i n d  ------