[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] non static libs on windows (dll)

From: <seanc_at_dimensionalrift.com>
Date: 2003-03-23 00:37:15 CET

> On Saturday, March 22, 2003, at 06:10 PM, Russell Yanofsky wrote:
>
>>> 4) Exported data structures should never contain an enum type. An
>>> int or similar type is far superior.
>>
>> Yes. I don't know whether subversion does this.
>
> not being a windows person, i have no idea why using enumerated types
> would be a problem. what exactly is the issue with this? i've always
> been told to prefer enums for reasons of type safety.
>

  The size of an enum varies from compiler to compiler, and according to
the language only needs to be as large as to contain any of the enum
values correctly. With VC an enum is always an int, but it shouldn't be
assumed. The following enum might end up being a char for instance:

enum foo
{
booga=0,
wooga=1,
};

This is one reason why many of MS's enums in DirectX for example all have
dummy values at the end of the enum like this:

typedef enum _D3DCULL {
    D3DCULL_NONE = 1,
    D3DCULL_CW = 2,
    D3DCULL_CCW = 3,
#if(DIRECT3D_VERSION >= 0x0500)
    D3DCULL_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
#endif /* DIRECT3D_VERSION >= 0x0500 */
} D3DCULL;

I wish someone would change the langauge standards so you could specifiy
which data type an enum should use . . .

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Mar 23 00:37:54 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.