Re: [AD] namespace collision

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On 10 Aug 2001, Evert Glebbeek <eglebbk@xxxxxxxxxx> wrote:
> >If we go for prefixing, we could use inline functions for the
> >old names, and require the user to use the new names if they
> >need to do anything dodgy like take the address of a function.
> >Can you see any problems with this?  The inline versions would
> >only exist in allegro.h, optionally excluded by setting a
> >define.  The huge advantage of inline functions is that the
> >compiler understands context, so we won't damage class methods.
> 
> Nice! I think this actually solves all problems, doesn't it? Though I think
> that there will be a loss in performance when calling a function from a
> pointer, like in the dialog routines. Probably minor. How would you require
> the user to use the new names when taking the address, by the way

Presumably, what we'd do is this: old-name compatibility functions
would be defined in `allegro.h', and marked with "extern inline" (a
gcc-ism, AFAIK).  The compiler can use those definitions to produce
inlined code, but it won't actually produce the function.  Since the
function won't exist, your code won't link.

The only concern I have is whether other compilers support the idea
of "extern inline", whether using those exact keywords or others.

I think "static inline" was used in older versions of gcc.  The
difference between "static inline" and "extern inline" in (newer)
gcc is that "static inline" *will* produce a function, at least
sometimes (e.g. when you take the address of that function).  It's
probably best not to use "static inline", though, in case it makes
our code size blow up.

[OTOH, after googling a bit, I read that C99 (ick) has different
semantics for "extern inline" than gcc currently has.  It was a
mailing list post, so I don't know if that's true or out of date.]

> (and doesn't that still break existing code?)

Yes, but it's uncommon :-)

-- 
THERMALOPHOBIA (thur muh lo FO be uh), n.  The fear when showering that
someone will sneak in, flush the toilet, and scald you to death.
	-- Rich Hall, "Sniglets"



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/