TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: All
from: Bob Stout
date: 2003-09-12 15:36:54
subject: Re: Re: Pointers

From: rbs{at}snippets.org
To: c_echo{at}yahoogroups.com

Quoting Rob Swindell:

>  > Since using "=" when you mean "==" is one of
the most common mistakes
>  > (usually, it's a typo and is even made by experienced C programmers),
>  > putting the constant on the left changes the compiler's action from a
>  > warning to an error.
>  >
>  > if (x == 6)	/* what you mean */
>  >
>  > if (x = 6)	/* warning, possible unintended assignment */
>
> Yes, and modern compilers will give you a "possibly incorrect
assignment"
> warning, bringing this to your attention.

Yes, that's what I said.

>  > if (6 = x)	/* error, assignment to a constant */
>
> So now you have an error instead of a warning. 

Warnings can be ignored, errors cannot.

-------------------------------------------------------------
Consulting: http://www.MicroFirm.biz/
Web graphics development: http://Image-Magicians.com/
Software archives: http://snippets.org/snippets/
Audio and loudspeaker design:
  http://LDSG.snippets.org/
  http://www.diyspeakers.net/

-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/

--- SoupGate-Win32 v1.05
* Origin: rbs{at}snippets.org (2:292/516.666)
SEEN-BY: 633/267 270
@PATH: 292/516 854 140/1 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™.