delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/30/01:37:59

From: j DOT aldrich6 AT genie DOT com
Message-Id: <199605300519.AA074613543@relay1.geis.com>
Date: Thu, 30 May 96 05:07:00 UTC 0000
To: djgpp AT delorie DOT com
Mime-Version: 1.0
Subject: Re: Q: bool, _fixpath

Reply to message 7984957    from NICOLAS AT JUPIT on 05/28/96  7:18AM


>I have two questions. I think answers are not in the FAQ :-)
>
>1. Can someone give me some info about "bool" data type. Is this
>   a default type under gcc ? What are possible values (true, false,
>   TrUe, TRUE...) ? How is it coded in memory (one bit, one int...).
>   I couldn't find anything about that in info pages.

There is no "bool" data type under ANSI C.  DJGPP does include
a 'bool.h' header (in lang/cxx/bool.h) that defines the following:

#define bool int
#define true 1
#define false 0

Also, AFAIK, C++ defines bool as a reserved word.

For the most part, there is no standard definition of boolean data
types - if you don't want to quibble with it, just make one that suits
your purposes.  My personal preference is this:

typedef unsigned char    bool;
#if !defined(TRUE)
#define TRUE 1
#endif
#if !defined(FALSE)
#define FALSE 0
#endif

You could also add a check to see if 'bool' is defined, but it doesn't
make a whole lot of difference.

>2. I use the _fixpath function from libc, and it works very well,
>   except that... it is NOT defined in any headers. In fact, the
>   definition is commented out. WHY ? Will this function not be
>   supported in the future ? What can I use in replacement ?

_fixpath is defined in <sys/stat.h>.  It is fully supported by DJGPP.
It's right there in the docs (info libc alpha _fixpath).

John

- Raw text -


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