Author: Dann Corbit
Date: 11:01:33 10/14/99
Go up one level in this thread
On October 13, 1999 at 20:05:47, Ratko V Tomic wrote: >I thought so and just moved two functions at the top and the compiler was happy. >Generally, I think specifying function arguments & return value at the top of >function and in the header as prottype (as required in C++) can only increase >the probability of coding error (as does anything that requires keying in two or >more times the identical thing) and doesn't help the slightest anything else. If >functions are used in other modules then the existence of that function >prototype in the header carries some nonzero info useful in program maintance >(e.g. you then know if you modify the function you need to visit and see other >modules for any side-effects). But when all functions, whether used outside or >just within a module, have their protypes in the header, this useful info is >lost. You also, in practice, lose backward reference code structure, which is >quite helpful if you're looking at other persons code and wish to get a quick >idea of the hierarchy of the code. If the code doesn't have extrenious protoypes >in the header, then you know that the low level support functions are at the top >of the file and higher level logic at the bottom of the file. With headers used >to cover the forward references, you lose that kind of hierarchy info (or >discipline) as well. I am not absolutely sure that I am following you here. If you want to export the functions you must prototype them. And to be sure that the prototype is correct, you must include it in the file that contains the functions. I do sometimes remove the prototypes from header files and compile. The reason is to get the functions in the proper order. If each function is defined before it is used, this can help the compiler to inline. But I always put the prototypes back when I am done. I think that reading the file is a terrible way to understand the structure. I use tools like Rational Rose for that, and I also flow chart C code with my ancient copy of CCLEAR. That's right. I'm one of those fossils who still flowcharts.
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.