[GSoC] Header Generation for C/C++
Jacob Carlborg
doob at me.com
Mon Jul 22 09:47:31 UTC 2019
On 2019-07-17 22:59, Manu wrote:
> Okay... but it's also the worst thing ever, and no real user would
> want this code to be emit from the compiler ;)
> Safe to say this is a strictly DMD-specific naming pattern, and I
> don't think that should be our benchmark for a public-facing feature.
>
> A better non-C++11 name might be `TestEnum_aa`?
In Apple's frameworks, in particular the Objective-C frameworks, they
define enums like this:
typedef NS_ENUM(int, MKAnnotationViewDragState)
{
MKAnnotationViewDragStateNone = 0,
MKAnnotationViewDragStateStarting,
MKAnnotationViewDragStateDragging,
MKAnnotationViewDragStateCanceling,
MKAnnotationViewDragStateEnding
}
Where NS_ENUM expands, in the above case, to:
typedef int MKAnnotationViewDragState; enum
{
MKAnnotationViewDragStateNone = 0,
MKAnnotationViewDragStateStarting,
MKAnnotationViewDragStateDragging,
MKAnnotationViewDragStateCanceling,
MKAnnotationViewDragStateEnding
}
Probably makes it easier to present a nice interface in Swift.
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list