Re: Use enum to declare errno values

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

 



Coywolf Qi Hunt <[email protected]> wrote:
> 2005/12/3, Bill Davidsen <[email protected]>:
> > Coywolf Qi Hunt wrote:

> > > This is a reason why enums are worse than #defines.
> > >
> > > Unlike in other languages, C enum is not much useful in practices.

> > Actually they are highly useful if you know how to use them. They allow
> > type checking, have auto increment, and are part of the language instead
> >   of a feature of the preprocessor.

The preprocessor /is/ part lof the language...

> Yes, I know type checking and auto increment. But they are not
> worthwhile, at least not for serious C programming.

They do have their uses. No, C (particularly as used today) is not a
"designed" language, it has several ways of doing the same thing, some
quirks, and outright design mistakes.

>                                                     No, I don't know
> how to use them comfortably.

Then you aren't fit to judge, are you?

> What's wrong with sorted macros? They are more flexible

"More flexible" == "more leeway to screw up"...

>                                                         and readable.

"Readable" is in the eye of the beholder...

> enums just look weird.

Ditto.

>                        We also share macros b/w C and asm.

So what?

[...]

> Follow you logic, C standard should only specify C language, not
> anything of libc...  I have no interest in arguing the relations b/w C
> and cpp.

libc is part of the language, as is cpp.

[...]

> > It would have been good to use enums in the first place, I can't see
> > changing now because of the effort involved.

> You contradict yourself rather.

No. The difference between them is not /that/ large, and by now the use of
#define is so much part of the "way things are done" that the pain of
changing it doesn't buy you enough.

What I see is that you don't know too much about large-scale software
development (and Linux is definitively in that league).
-- 
Dr. Horst H. von Brand                   User #22616 counter.li.org
Departamento de Informatica                     Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria              +56 32 654239
Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513
-
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