swarm-support
[Top][All Lists]
Advanced

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

Re: Circular ".h" files


From: Rick Riolo
Subject: Re: Circular ".h" files
Date: Mon, 12 Jul 1999 06:55:55 -0400 (EDT)

You say the following didn't work?

> donalson> #ifndef LISTMEMBER_H
> donalson> #define LISTMEMBER_H
> donalson> //contents of .h file here
> donalson> #endif

If I understand your problem, and if that is contents 
of ListMember.h, I don't see how that couldn't work.
That trick dates back to regular C, and it works fine in that
(at least it did for me, using lots of different compilers).
Note that trick is not really dependent on any special feature
in the preprocessors, just on the preprocessor doing
what its supposed to do with #ifndef and #define!

- r



Rick Riolo                           address@hidden
Center for Study of Complex Systems (CSCS)
4477 Randall Lab                
University of Michigan         Ann Arbor MI 48109-1120
Phone: 734 763 3323                  Fax: 734 763 9267
http://www.pscs.umich.edu/PEOPLE/rlr-home.html

On Sun, 11 Jul 1999, donalson wrote:

> Date: Sun, 11 Jul 1999 18:07:44 -0700
> From: donalson <address@hidden>
> Reply-To: address@hidden
> To: address@hidden
> Subject: Re: Circular ".h" files
> 
> Norberto,
> 
>    I thought that I remembered this.  Unfortunatly, I use import.  It seems 
> that
> at least in the Cygnus
> version, it doesn't work.  I also know that another grad student here used 
> Swarm
> for a while on
> our sparc stations and had the same problem.  One fix he came up with was to 
> put
> the .h
> files that needed references in the implementation files instead of the .h
> files.  This only seems to occur with user defined objects as opposed to swarm
> provided objects.
> 
> The link did remind me that ObjC might take the preprocessor dir's that I put 
> in
> my previous
> email, I gave that a try.  At least for a quick hack, it didn't work.  In the
> mean time, although I still have
> a multiple interface def warning, my error turned out to be far less ethereal 
> in
> nature and I fixed that.
> 
> Thanks for the ideas and the link.
> 
> Cheers,
> 
>    D3
> 
> Norberto Eiji Nawa wrote:
> 
> > Hello Doug,
> >
> > I found this in the Apple's Objective C documentation
> > (http://developer.apple.com/techpubs/macosxserver/ObjectiveC/index.html):
> >
> > "PREPROCESSOR DIRECTIVES
> >
> >   The preprocessor understands these new notations:
> >
> >
> > Notation and Definition
> >
> >   #import
> >
> >
> >      Imports a header file. This directive is identical to #include,
> > except that it won't include the same file more than once."
> >
> > So using "#import <myheader.h>" instead of "#include <myheader.h>"
> > should avoid circular references.
> >
> > Hope it is a useful piece of information.
> >
> > Eiji
> >
> > donalson> In C++ there is a way to avoid the problems with circular ".h" 
> > file
> > donalson> references by using
> > donalson> #ifndef LISTMEMBER_H
> > donalson> #define LISTMEMBER_H
> > donalson> //contents of .h file here
> > donalson> #endif
> > donalson> Is there any similar method in ObjC?
> > donalson> Cheers,
> > donalson>    D3
> >
> >                   ==================================
> >    Swarm-Support is for discussion of the technical details of the day
> >    to day usage of Swarm.  For list administration needs (esp.
> >    [un]subscribing), please send a message to <address@hidden>
> >    with "help" in the body of the message.
> 
> --
> *********************************************************************
> * Doug Donalson                 Office: (805) 893-2962
> * Ecology, Evolution,           Home:   (805) 961-4447
> * and Marine Biology            email address@hidden
> * UC Santa Barbara
> * Santa Barbara Ca. 93106
> *********************************************************************
> *
> *   The most exciting phrase to hear in science, the one that
> *   heralds new discoveries, is not "EUREKA" (I have found it) but
> *   "That's funny ...?"
> *
> *       Isaac Asimov
> *
> *********************************************************************
> 
> 
> 
>                   ==================================
>    Swarm-Support is for discussion of the technical details of the day
>    to day usage of Swarm.  For list administration needs (esp.
>    [un]subscribing), please send a message to <address@hidden>
>    with "help" in the body of the message.
> 
> 


                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

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