Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #8056

Re: flowto (Just for fun)

From Ike Naar <ike@sverige.freeshell.org>
Newsgroups comp.lang.c
Subject Re: flowto (Just for fun)
Date 2011-07-10 08:51 +0000
Organization A noiseless patient Spider
Message-ID <slrn3vfsj1iq03.5fi.ike@sverige.freeshell.org> (permalink)
References <1b6e1f81-b774-4ddc-9af4-68607dbed1a7@glegroupsg2000goo.googlegroups.com> <87mxgqlgc7.fsf@temporary-address.org.uk> <87zkkp4q4h.fsf@bazspaz.fatphil.org> <9e27aa89-740f-415d-90e4-33c1e977485b@q1g2000vbj.googlegroups.com> <87sjqe3o58.fsf@bazspaz.fatphil.org>

Show all headers | View raw


On 2011-07-10, Phil Carmody <thefatphil_demunged@yahoo.co.uk> wrote:
> gwowen <gwowen@gmail.com> writes:
>> On Jul 8, 12:39?am, Phil Carmody <thefatphil_demun...@yahoo.co.uk>
>> wrote:
>> 
>> > However, making it a solitary enum just to avoid making it a #define is
>> > nothing more than sophistry.
>> 
>> Scoping is not sophistry.
>
> You can make #defines disappear just as easily as enums, were that
> to be an issue.

Actually, it can be a bit tricky to do it well.
Can you demonstrate how easily the enums can be replaced by #defines
in the program below?

#include <assert.h>

enum {value = 0};
int global = value;

void foo(int, int);

int main(void)
{
  enum {value = 1};
  foo(global, value);
  return 0;
}

void foo(int i0, int i1)
{
  assert(i0 == value && i1 == 1);
}

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar


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