discuss-gnustep
[Top][All Lists]
Advanced

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

Re: Problem with my first app


From: Stan Shebs
Subject: Re: Problem with my first app
Date: Sun, 14 Oct 2001 15:38:35 -0700

"Philippe C.D. Robert" wrote:
> 
> On Sun, 14 Oct 2001 13:58:25 -0400
> Jason Clouse <address@hidden> wrote:
> 
> > > - ObjC headers should be #imported, not #included
> >
> > To change the subject, why is #import deprecated in gcc?  It strikes me as 
> > odd to support a solution which: (1) breaks with established practice; (2) 
> > is--even if only mildly so--ugly; and (3) requires more typing :-).  It 
> > seems to me that using #import gives you one less thing to remember to do.
> 
> I don't know  - but I know that I dislike it *very much*. Your 3rd point is 
> IMHO even a worse one because it is not only about typing but about having 
> developers to type more ifdefs/defines, that is train them to use them all 
> over the place, very ugly indeed!

#import is not well-defined, and hard, perhaps even impossible, to
get right for all OSes and and all filesystems.  The problem is that
it requires a notion of file identity, so it can know to avoid
including the "same" file more than once.  But how do you detect
"same" file?  By name?  No, because of symlink tricks.  By inode?
Better, but not every filesystem has inodes, and other filesystems
have inodes that are dynamically assigned as for instance NFS
mounts and unmounts things.  This is not hypothetical, Apple has
experienced some mysterious include bugs caused by these kinds of
effects.  By md5?  Can't check it without reading the whole file,
not good for performance.  Yes, the md5 could be stored in the
filesystem, but then we're back to the portability problem.

The #ifndef/#define strategy requires the programmer to establish
a single global space of #defines.  It can still fail, for instance
when mixing packages that have similarly-named include files, but
at least everything is explicit and well-defined.

> BTW what says Apple to this, will they change to "#include" then as well 
> (guessing that they will upgrade to gcc 3.x anytime in the midterm future as 
> well)?

No, we'll continue to use #import, and turn off the warning too in
Apple's version of GCC.  And yes, 3.x is in the works, I'm personally
in C++ hell right now (ObjC "just works", while C++ is a huge pain).

Stan



reply via email to

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