Re: [HTCondor-devel] Conflicting hold codes?


Date: Mon, 13 May 2013 11:29:48 -0500
From: Alan De Smet <adesmet@xxxxxxxxxxx>
Subject: Re: [HTCondor-devel] Conflicting hold codes?
Brian Bockelman <bbockelm@xxxxxxxxxxx> wrote:
> Why not do something like:
> 
> enum hold_codes {
>   unspecified = 1,
>   foo = 2,
>   outofresources = 3
> };
> 
> ?  That way, we can keep stable across series and detect overlaps at compile-time.

Are you expecting the compiler to notice and complain if I say
something like this?

enum hold_codes {
  unspecified = 1,
  foo = 1
};

GCC lets it pass without a complaint, even with -Wall -Wextra.  I
believe it's valid code, although I'm too lazy to check.

(That said, I do generally prefer enums over #defines, as the
debugger can give you more useful information in some
situations.)

-- 
Alan De Smet                 Center for High Throughput Computing
adesmet@xxxxxxxxxxx                       http://chtc.cs.wisc.edu
[← Prev in Thread] Current Thread [Next in Thread→]