[m-rev.] for review: fix MSVC LLDS code compilation

Peter Ross pro at missioncriticalit.com
Mon May 28 11:24:38 AEST 2007


On 5/28/07, Zoltan Somogyi <zs at csse.unimelb.edu.au> wrote:
> On 28-May-2007, Peter Ross <pro at missioncriticalit.com> wrote:
> > Could you just check the following.
> > It doesn't give any warnings under gcc.
> >
> > compiler/llds_out.m:
> >       MSVC treats declarations such as
> >               "static const struct s a[];"
> >       as definitions.  As a definition it doesn't know the size
> >       of the definition, so aborts.
> >       Thus we now output
> >               "extern const struct s a[];"
> >       which both gcc and msvc seem to handle.
>
> I am surprised this doesn't get a warning from gcc. "extern" indicates
> the symbol is visible outside the module; "static" indicates it is not
> visible. Having a declaration use one and the definition use the other
> is definitely something that at least *some* versions of gcc generate
> warnings about, at least with *some* options that we use.
>
I thought so as well

I thought I had also tried the following and got an error message, but
it appears not, as I just retried with msvc and gcc 3.4.4

static struct s array[2];
......
static struct s array[2] = {{1}, {2}};

This seems to be accepted by everything.
Are there any issues with this?
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list