On 10/27/2013 12:11 AM, Michel Fortin wrote:
On 2013-10-26 14:52:42 +0000, Mike Parker <[email protected]> said:

On 10/26/2013 9:09 PM, Benjamin Thaut wrote:
Am 25.10.2013 15:10, schrieb Lionello Lunesu:

1. enum names vs prefixes
enum FOO { FOO_A, FOO_B }; -> enum FOO {A,B}

I actually do number 1 whenever creating C bindings. Because its not
really DRY to write: FOO.FOO_A

alias FOO = int;
enum { FOO_A, FOO_B };

Otherwise, it doesn't match the C API.

But then you lose the type-safety of an enum. Why not this:

     enum FOO { FOO_A, FOO_B };
     alias FOO.FOO_A FOO_A;
     alias FOO.FOO_B FOO_B;

?

Overly verbose perhaps.


When you do it by hand, as I do, this approach can make you cry.

Reply via email to