Function prototype + definition in the same file

Manu turkeyman at gmail.com
Thu Sep 27 04:10:32 PDT 2012


On 26 September 2012 20:28, Rainer Schuetze <r.sagitario at gmx.de> wrote:

>
> I think this should be allowed, aswell as implementing forward declared
> enums and structs (IIRC the compiler even has some error messages that
> suggest that it is intended).
>
> As a workaround, you could put your prototypes into a struct and generate
> the declarations for the static linking and the stubs for dynamic linking
> from their declarations and run your magic on the members of "prototypes":
>
> struct prototypes
> {
>         void fun1(int a, int b);
>         void fun2(int a, int b);
> }
>
> mixin(magic([__traits(**allMembers, prototypes)])
>
>
> That way you don't put the symbols into the same scope as the prototypes,
> and you will not add new symbols to the same scope that you are iterating
> over.
>

Good idea! I'll give that a shot.

So it seems like there is fairly general consensus on this then, is there a
next step? Should I log a bug? (I think I did log one months ago)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120927/fa1a01a7/attachment.html>


More information about the Digitalmars-d mailing list