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


Groups > comp.lang.c > #11049

macro with the same name in translation unit

From "Mark" <mark_cruzNOTFORSPAM@hotmail.com>
Newsgroups comp.lang.c
Subject macro with the same name in translation unit
Date 2011-09-28 10:53 -0400
Organization Aioe.org NNTP Server
Message-ID <j5vce0$4sa$1@speranza.aioe.org> (permalink)

Show all headers | View raw


Hi,

consider the snippet:

#include <stdio.h>

#define DUMMY 100
#define FOO 200
#define DUMMY 200

int main (void)
{
    printf("%d, %d\n",FOO, DUMMY);
    return 0;
}

The compiler I'm using (gcc-4.1.2) emits warning message about redefined 
macro, but picks up and prints the last defined, i.e. with value 200. Is 
this platform dependent behavior, or undefined behavior?

Thanks.

Mark 

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


Thread

macro with the same name in translation unit "Mark" <mark_cruzNOTFORSPAM@hotmail.com> - 2011-09-28 10:53 -0400
  Re: macro with the same name in translation unit James Kuyper <jameskuyper@verizon.net> - 2011-09-28 11:41 -0400
    Re: macro with the same name in translation unit Keith Thompson <kst-u@mib.org> - 2011-09-28 09:22 -0700
      Re: macro with the same name in translation unit James Kuyper <jameskuyper@verizon.net> - 2011-09-28 13:16 -0400
        Re: macro with the same name in translation unit Keith Thompson <kst-u@mib.org> - 2011-09-28 13:42 -0700
          Re: macro with the same name in translation unit James Kuyper <jameskuyper@verizon.net> - 2011-09-28 17:18 -0400

csiph-web