| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Re: [C] Question about external variable initialization |
From: Bob Stout
On 29 Jan 2004 andrew.clarke!3.633.267.0{at}filegate.net wrote:
> ac>> if (tmptext == NULL)
> ac>> return NULL;
>
> RJT> Or make that
> RJT> if (NULL == tmptext)
>
> Hmm. Are you left-handed? (-:
Nope, an old C programmer's trick. One of the more common C errors is
typing "=" when you mean "==". If your warning level is
set too low...
if (tmptext = NULL)
...may pass unnoticed. You may even ignore it if it is reported as a
warning. However...
if (NULL = tmptext)
...will always generate a compile-time error you cannot ignore. It will
*force* you to fix it.
-------------------------------------------------------------
Consulting: http://www.MicroFirm.biz/ Web graphics development:
http://Image-Magicians.com/ Software archives:
http://snippets.snippets.org/
c.snippets.org/ cpp.snippets.org/ java.snippets.org/
d.snippets.org/ python.snippets.org/ perl.snippets.org/
dos.snippets.org/ embedded.snippets.org/ apps.snippets.org/
Audio and loudspeaker design:
http://LDSG.snippets.org/ http://www.diyspeakers.net/
--- BBBS/LiI v4.01 Flag-5
* Origin: Prism's_Point (1:261/38.1)SEEN-BY: 633/267 270 @PATH: 261/38 123/500 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™.