On Fri, Oct 23, 2009 at 9:41 AM, Richard Frith-Macdonald <
[email protected]> 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 discuss-gnustep.gnu.org  list:

http://lists.gnu.org/archive/html/discuss-gnustep/2009-10/msg00149.html

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.

David

Best Regards
_______________________________________________
Help-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gnustep

Reply via email to