Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: flowto (Just for fun) |
| Date | 2011-07-07 17:09 -0700 |
| Organization | None to speak of |
| Message-ID | <lnd3hlzl8g.fsf@nuthaus.mib.org> (permalink) |
| References | <1b6e1f81-b774-4ddc-9af4-68607dbed1a7@glegroupsg2000goo.googlegroups.com> <87mxgqlgc7.fsf@temporary-address.org.uk> <87zkkp4q4h.fsf@bazspaz.fatphil.org> |
Phil Carmody <thefatphil_demunged@yahoo.co.uk> writes:
> Dr Nick <3-nospam@temporary-address.org.uk> writes:
>> luser- -droog <mijoryx@yahoo.com> writes:
>>
>> > On Saturday, July 2, 2011 1:58:27 AM UTC-5, io_x wrote:
>> >> "Shao Miller" <sha0....@gmail.com> ha scritto nel messaggio
>> >> news:iul55q$a22$1@dont-email.me...
>> >> i prefer- and all goes well- C macro if without arg
>> >> something as
>> >> #define nome1 0x123
>> >
>> > This is better as an enum
>> > enum { nome1 = 0x123 };
>>
>> Very debatable. I really don't like the use of enums just as isolated
>> symbolic constants, and I don't think I'm alone in this.
>
> You are not alone. I abhor magic numbers. If there's any chance that a
> number will be used twice, it should be some kind of symbolic constant.
> However, making it a solitary enum just to avoid making it a #define is
> nothing more than sophistry.
I disagree; it's considerably more than sophistry.
It's a use of the "enum" feature for a purpose for which it was
probably never intended. But it *works*, in the sense that it makes
a specified identifier usable as a constant expression of type int.
If I were looking for complete purity and consistency, I'd likely
decide that C is not the language for me.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: flowto (Just for fun) luser- -droog <mijoryx@yahoo.com> - 2011-07-07 00:03 -0700
Re: flowto (Just for fun) Dr Nick <3-nospam@temporary-address.org.uk> - 2011-07-07 08:06 +0100
Re: flowto (Just for fun) Shao Miller <sha0.miller@gmail.com> - 2011-07-07 19:34 -0400
Re: flowto (Just for fun) Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-07-08 02:39 +0300
Re: flowto (Just for fun) Keith Thompson <kst-u@mib.org> - 2011-07-07 17:09 -0700
Re: flowto (Just for fun) gwowen <gwowen@gmail.com> - 2011-07-08 03:10 -0700
Re: flowto (Just for fun) Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-07-10 04:44 +0300
Re: flowto (Just for fun) Ike Naar <ike@sverige.freeshell.org> - 2011-07-10 08:51 +0000
Re: flowto (Just for fun) Dr Nick <3-nospam@temporary-address.org.uk> - 2011-07-10 10:52 +0100
Re: flowto (Just for fun) Ike Naar <ike@sverige.freeshell.org> - 2011-07-10 11:12 +0000
Re: flowto (Just for fun) Dr Nick <3-nospam@temporary-address.org.uk> - 2011-07-10 12:15 +0100
Re: flowto (Just for fun) Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-07-11 03:32 -0700
Re: flowto (Just for fun) Dr Nick <3-nospam@temporary-address.org.uk> - 2011-07-11 20:11 +0100
Re: flowto (Just for fun) Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-07-10 20:42 +0300
Re: flowto (Just for fun) "io_x" <a@b.c.invalid> - 2011-07-11 08:08 +0200
Re: flowto (Just for fun) luser- -droog <mijoryx@yahoo.com> - 2011-07-10 23:51 -0700
Re: flowto (Just for fun) "io_x" <a@b.c.invalid> - 2011-07-11 09:15 +0200
Re: flowto (Just for fun) "io_x" <a@b.c.invalid> - 2011-07-08 20:06 +0200
csiph-web