Charles Mills wrote:

Different from C, where you use extern on both ends.

Charles

Generally speaking, C has a few models of how to do this.

One is called the "common" model - where what you say is true.

The other is called the "strict ref-def" model; where you can only
have one definition and any number of references.

Also - in the common model, you can have multiple definitions.

For example; one file might have:

       struct my_struct {
                int array[200];
      } var;

and another might have:

      long double var;

The linker simply allocates the largest amount of declared space and names
it "var" (with probably disasterous results at runtime.)

Both of these are definitions - but because they are not intiailized, it goes
into "common" space (a name borrowed from FORTRAN.)

I prefer the strict ref-def model - one definition, many references. But, very few
C implementations support that.

Some of the implementation details of C++ depend on the ability to do common-like
things...

  - Dave Rivers -

--
[email protected]                        Work: (919) 676-0847
Get your mainframe programming tools at http://www.dignus.com

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to