• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: C again
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C again


  • Subject: Re: C again
  • From: Eric Friedman <email@hidden>
  • Date: Tue, 2 Sep 2003 20:13:36 -0700

It was probably covered in that thread too, but the other way to get the same effect is to write the tests like this:
(0 == error)
this will produce a compile error if you accidently type '=' instead of '==', since it's illegal to make an assignment to a constant. Personally, I find this easier to read/write than the macro John provided, but that's a style choice and so entirely subjective.

Eric


On Tuesday, September 2, 2003, at 01:39 PM, John Randolph wrote:

On Aug 30, 2003, at 6:41 PM, Angela Brett wrote:

while (((ch = PEEK (myFile)) != EOF) && (error = 0))

I think you mean (error==0)

About a month ago, there was a rather long thread in this list about using a macro like

#define is ==

to preclude this kind of error.

Look for it in the archives under the subject "C question for you old guys".

-jcr


John C. Randolph <email@hidden> (408) 974-8819
Sr. Cocoa Software Engineer,
Apple Worldwide Developer Relations
http://developer.apple.com/cocoa/index.html
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: C again (From: John Randolph <email@hidden>)

  • Prev by Date: Re: dylib (libz) access and use?
  • Next by Date: Re: Menu items validation woes...
  • Previous by thread: Re: C again
  • Next by thread: Selector runs only once
  • Index(es):
    • Date
    • Thread