1

I was parsing some modified C++ headers with IDA when I come to some strange behavior. Imagine we have a structure like this (stored in a C header):

struct S
{
    enum {EN0, EN1};

    int m1;
} ;

When I parse it with IDA Pro the created type seems to threat the first unnamed enum as data member inside the structure. I'm thinking - is this correct behavior in the case?

I tested this on online C compiler which seems not to count the enumeration inside struct S as part of its data (here - i tested sizeof of S when there is only enum in it and it gave size of 0).

3

It's just a definition of an ENUM there is no declaration.

Try this:

struct S
{
    enum {EN0, EN1} myEnum;

    int m1;
} ;

Now we have two ints.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.