Re: Use enum to declare errno values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

2005/12/2, Denis Vlasenko <[email protected]>:
> > There is another reason why enums are better than #defines:

On 12/2/05, Coywolf Qi Hunt <[email protected]> wrote:
> This is a reason why enums are worse than #defines.
>
> Unlike in other languages, C enum is not much useful in practices.
> Maybe the designer wanted C to be as fancy as other languages?  C
> shouldn't have had enum imho. Anyway we don't have any strong motives
> to switch to enums.

I don't follow your reasoning. The naming collision is a real problem
with macros. With enum and const, the compiler can do proper checking
with meaningful error messages. Please explain why you think #define
is better for Denis' example?

                                     Pekka
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux