Robert P. J. Day wrote:

> also, i'm assuming that some source file must eventually include an
> actual definition of a "Widget" for the purposes of linking, as in:
> 
>   #include "widgets.h"
>   ...
>   Widgets Widget ;

Correct.

> however, given the inclusion of the header file, doesn't this give me
> both a referencing declaration and a defining declaration of that
> object in the same file?

It gives you both a declaration and a definition in the same
compilation unit.

> is there no problem with that?

No.

If there was, you wouldn't be able to have forward declarations, and
thus wouldn't be able to define mutually-recursive functions.

>  i was under
> the impression that common practise was to have a single defining
> declaration and all the *remaining* be referencing declarations.

You shouldn't define a symbol more than once in any compilation unit,
but you can declare it as many times as you like.

-- 
Glynn Clements <[EMAIL PROTECTED]>
-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" 
in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to