delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/18/09:30:21

From: Dave Pearson <davep AT hagbard DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Why two identical typedef are considered an error in DJGPP?
Date: Sat, 18 Jan 1997 01:01:22 GMT
Organization: Hagbard's World (A Private Internet Host)
Lines: 46
Sender: usenet AT hagbard DOT demon DOT co DOT uk
Message-ID: <slrn5e086r.gp5.davep@hagbard.demon.co.uk>
References: <01IE7MKQWZ2Q003361 AT cc DOT uab DOT es> <Pine DOT A41 DOT 3 DOT 94 DOT 970115082052 DOT 92882A-100000 AT acs2 DOT acs DOT ucalgary DOT ca> <jRKDPBAXkX3yEw9J AT foobar DOT co DOT uk>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Paul Shirley <Paul AT foobar DOT co DOT uk DOT chocolat> wrote:

> >if not defined "BYTEdefined"
> >define "BYTEdefined"
> >declare BYTE
> >end if
> 
> #ifndef BYTE
> typedef unsigned char BYTE;
> #endif
> 
> ...is what I usually do.

And it works for you? In that case, this should work:

----------------------------------------------------------------------
#ifndef BYTE
typedef unsigned char BYTE;
#endif

#ifndef BYTE
typedef unsigned char BYTE;
#endif

int main( void )
{
    return( 0 );
}
----------------------------------------------------------------------

Compiler output (GCC on Linux):

----------------------------------------------------------------------
davep:~/temp$gcc foo.c
foo.c:6: redefinition of `BYTE'
foo.c:2: `BYTE' previously declared here
----------------------------------------------------------------------

Hmm....

-- 
Take a look in Hagbard's World: |     w3ng - The WWW Norton Guide reader.
http://www.acemake.com/hagbard  |  ng2html - The NG to HTML converter.
Also available in the UK:       |       eg - Norton Guide reader for OS/2.
http://www.hagbard.demon.co.uk  |   dgscan - DGROUP scanner for Clipper.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019