[fpc-pascal] function alias

Mattias Gaertner nc-gaertnma at netcologne.de
Sat Oct 6 22:18:04 CEST 2007


On Sat, 6 Oct 2007 21:43:30 +0200
ik <idokan at gmail.com> wrote:

> On 10/6/07, Mattias Gaertner <nc-gaertnma at netcologne.de> wrote:
> > On Thu, 4 Oct 2007 20:17:36 +0200 (CEST)
> > Daniƫl Mantione <daniel.mantione at freepascal.org> wrote:
> >
> > >
> > >
> > > Op Thu, 4 Oct 2007, schreef Mattias Gaertner:
> > >
> > > > Yes, but I hoped to declare it in situ - without adding another
> > > > type. ;) The reason is that I'm auto translating some C headers
> > > > that contains aliases for functions.
> > >
> > > procedure DoAliasSomething(...params...); cdecl; external
> > > 'useful';
> > >
> > > ... is another approach.
> >
> > Ok. I implemented that.
> >
> > I'm curious: Why does fpc not allow
> > const FuncAlias = MyFunc;
> > ?
> 
> Yuck, that reminds me of C++ templates. it allows you to alias "{" as
> "begin" (for example) and also to make such aliases... 

Sounds more like macros, than templates.


>  it can create a
> lot of problems when people does not fully understand what you have
> done.
> 
> I can think on other way to implement "alias":
> 
> procedure OriginalProc(..).. {$IFDEF USEINLINE_ALIAS}inline;{$ENDIF}
> begin
> end;
> ...
> 
> procedure AliasProc(...);
> begin
>   {$DEFINE USEINLINE_ALIAS}
>   OriginalProc(...);
>   {$UNDEF USEINLINE_ALIAS}
> end;
> 
> But it looks so ugly ...

And it's even more complicate. ;)


Mattias



More information about the fpc-pascal mailing list