TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Roger Scudder
from: Darin McBride
date: 1998-07-22 18:31:08
subject: Sub

RM> The biggest STOP is that I can't refer to a part 
RM> that is not before the
RM> one I'm presently 

 RS> You should place declerations (prototypes) for all functions at the
 RS> top of the source file.  This is optional in C and required in C++.
 RS> The correct way is to place prototypes in a header file and include
 RS> the header in all .c files that use one, some, or all of the functions.  

Required in C++?  No - I almost never do this.  I only use prototypes in
C++ when the function is part of a class or in another module.  Otherwise I
(almost) always define functions before they're used.

If a function needs to be visible before it is defined, prototype it in the
source file (.c, .cc, .C, .cpp, whatever).  If a function needs to be
visible in other modules, prototype it in the header file.  (If a function
needs to be visible to other DLLs/EXEs, export it...)  Simple rules... :-)

This also means that my main is always at the bottom of its module...


---
* Origin: Tanktalus' Tower BBS (1:250/102)
SEEN-BY: 396/1 622/419 632/371 633/260 267 270 371 634/397 635/506 728
SEEN-BY: 639/252 670/213 218
@PATH: 250/102 201 99 396/1 633/260 635/506 728 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.