[m-rev.] for review: fix link errors in profiling grades

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Aug 16 00:52:39 AEST 2002


On 15-Aug-2002, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> On 15-Aug-2002, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > Calling a function via a prototype which is different than
> > the one it was defined with violates the C standard, so this
> > is definitely problematic.
> 
> Why? In the hlc grades, these functions should never be called. That's why
> their bodies call MR_fatal_error.

Sorry, I should have said *defining* instead of calling.

For C compilers which support type-safe linkage,
such as Dave Hansen's port of lcc to .NET
(and probably also Rhys Weatherly's currently-under-development
C compiler for .NET), you'd get a link error.

Some day someone will add type-safe linkage to ordinary C
compilers on Linux, too, I hope.

> > Now, if that is the intent, then at very least there should be
> > an XXX comment explaining that it doesn't conform with the C
> > standard and explaining why this is justified.
> 
> OK, I added an explanation:
> 
>     # We generate prototypes for these functions before the definition
>     # to shut up the warning you would otherwise get.
>     #
>     # Note that the types in the prototype and the definition are
>     # lies. This is OK, because the only reason why we have these
>     # functions is that in the non-deep profiling grades, we need
>     # their addresses, because the library/profiling_builtin.m declares
>     # the corresponding predicates. These functions should never be
>     # called, since the combination of hlc and deep profiling is not
>     # (yet) supported.

That's an improvement, but it's still missing the XXX.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list