TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Roy J. Tellason
from: Neil Heller
date: 2003-08-20 18:12:02
subject: QWK problem(s)

WM> It indicates to the compiler that the value pointed to by x
WM> will not be modified by getshort(). So this function can take
WM> both const and non-const parameters. Without it, one might get
WM> a warning when calling it with a const parameter.

RJ> So you'd use one when the function is called,  to make it match.

It's not required for the calling function to cast formal parameters to 
const.

WM> In practice, in this particular context, it doesn't mean much.
WM> But I try always to add "const" to my * parameters, where
WM> possible.

RJ> I'm still not clear why that's a good thing to do.  But 
RJ> then,  it's been a long time since I was studying c 
RJ> seriously...

The way I was taught, the "const" is a nice way of letting people know 
that the function doesn't alter the parameter whatsoever.  That doesn't 
mean much if the parameter is being sent by value (as the previous 
example) but does make a difference if the variable is being sent by 
reference.

þ CMPQwk 1.42 999

--- Maximus/2 3.01
* Origin: COMM Port OS/2 juge.com 204.89.247.1 (281) 980-9671 (1:106/2000)
SEEN-BY: 633/267 270
@PATH: 106/2000 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™.