[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: printf: doens't print on WinXP installation

From: Eduardo Osorio Armenta
Subject: Re: printf: doens't print on WinXP installation
Date: Fri, 23 Oct 2009 11:54:12 -0500

On Fri, Oct 23, 2009 at 9:41 AM, Richard Frith-Macdonald <> wrote:

On 23 Oct 2009, at 15:25, Eduardo Osorio Armenta wrote:

try this:

#include <stdio.h>
instead of :          #import <stdio.h> 

I'm afraid that won't make any difference.

ok, i just extract this from  list:

David Chisnal wrote:
On 14 Oct 2009, at 00:30, Jean-Loïc Mauduy wrote:

#import <stdio.h>

This is wrong.  A few Objective-C tutorials make this mistake, and tell you to just use #import instead of #include in Objective-C programs, but this is terrible advice.  #include is a trivial preprocessor directive that just inserts the contents of the specified file at this point.  #import is a bit more clever, and ensures that the file is only ever inserted once.

Objective-C headers are, generally, designed to be used with #import.  A lot of C (and C++) headers, however, are not.  They will protect themselves from multiple inclusion with macros and may be designed to work differently if included more than once in a compilation unit.  If you get into the habit of using #import with C headers, then you are going to end up with something breaking eventually, and you are going to be very confused about why.  Only use #import with Objective-C headers; stick with #include for C headers.  This also provides a clue to people reading your code about what kind of header you are including.


Best Regards

reply via email to

[Prev in Thread] Current Thread [Next in Thread]