www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/02/02/10:50:53

Date: Tue, 2 Feb 1999 10:50:47 -0500
Message-Id: <199902021550.KAA00732@envy.delorie.com>
From: DJ Delorie <dj AT delorie DOT com>
To: djgpp AT delorie DOT com
In-reply-to: <3.0.6.32.19990202095727.008ef860@pop.netaddress.com> (message
from Paul Derbyshire on Tue, 02 Feb 1999 09:57:27 -0500)
Subject: Re: Really strange question about DJ headers.
References: <3 DOT 0 DOT 6 DOT 32 DOT 19990202095727 DOT 008ef860 AT pop DOT netaddress DOT com>
Reply-To: djgpp AT delorie DOT com

> In a lot of DJGPP headers I see stuff like
> 
> __DJ_pid_t
> #undef __DJ_pid_t
> #define __DJ_pid_t
> 
> where the exact string may vary from __DJ_pid_t. What does this do?

ANSI and POSIX require that all headers be independent - you should be
able to include stdio.h without stddef.h and expect everything to just
work.  However, they're not independent - there are some things in
stddef.h that are required for stdio.h, like size_t.  So, I used the
above constructs to paste in those kinds of definitions where needed
(they originate in <sys/djtypes.h>) without causing "multiple
definitions" errors due to them being in two or more headers.

The first line is replaced with something like "typedef int pid_t".
The second and third make it so that the next time a header does this,
*their* first line gets replaced with "".

- Raw text -


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