problem with incomplete type references in draft 8


Subject: problem with incomplete type references in draft 8
From: Paul Graham (pgraham@cadence.com)
Date: Mon May 06 2002 - 12:15:40 PDT


Section 3.5 (User-defined types) says:

    A type can be used before it is defined, provided it is first identified
    as a type by an empty typedef:

        typedef foo;
        foo f = 1;
        typedef int foo;

Is this really true? Can I do this:

    typedef bar;

    bar x = { 1'bz, 37 };

    typedef struct {
        bit a;
        int b;
    } foo;

In C (and VHDL) you can refer to an incomplete type only to use a pointer to
that type. The example given in this section suggests that you could do
something like declare a bunch of incomplete types at the top of a module,
use them throughout the module, then give their declarations at the end of
the module, forcing a two-pass compilation. Surely that's not the intent!

On the other hand, since we don't have pointers in the language (yet), why
allow incomplete types?

Can someone clarify the intent here?

Paul



This archive was generated by hypermail 2b28 : Mon May 06 2002 - 12:17:09 PDT