[m-dev.] [Q] rtti_name_c_type question

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Jun 27 03:34:08 AEST 2000


On 23-Jun-2000, Peter Ross <petdr at cs.mu.OZ.AU> wrote:
> Hi,
> 
> Below is the generated RTTI info for the type
> :- type t1 ---> t1.
> 
> The definitions for mercury_data_type__enum_name_ordered_t1_0 and
> mercury_data_type__enum_value_ordered_t1_0 should be 
> 
> static const MR_EnumFunctorDesc * mercury_data_type__enum_name_ordered_t1_0[1];
> static const MR_EnumFunctorDesc * mercury_data_type__enum_value_ordered_t1_0[1];
> 
> when compiling with the Microsoft Visual C++ compiler (the difference is
> that the array size is made explicit).

Hmm, yes, ANSI/ISO C does not allow forward declarations of static
variables with incomplete types, and an array type without an explicit
size is an incomplete type.

> Seeing that rtti_name_c_type is what generates this information, what is
> the best way to get the size of the array, particulary for things like
> du_ptag_ordered_table?

The simplest, though not ideal, solution is probably to simply to
make all those arrays have external (`extern') rather than internal
(`static') linkage, by changing rtti_name_linkage so that it checks
rtti_has_array_type as well as rtti_name_is_exported (perhaps renaming
the latter as rtti_name_should_be_exported).

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list