TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Roy J. Tellason
from: William McBrine
date: 2003-08-19 09:25:48
subject: Re: QWK problem(s)

-=> Roy J. Tellason wrote to William McBrine <=-

 WM> /* get a little-endian short, return an int */
 WM> unsigned getshort(const unsigned char *x)
 WM> {
 WM>         return ((unsigned) x[1] << 8) + (unsigned) x[0];
 WM> }

 RJT> What's the effect of that "const" in there?

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

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

... Message contents may settle during uploading.
--- MultiMail/Linux v0.45
* 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™.