stdbool.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* Copyright (C) 2001-2002 Free Software Foundation, Inc.
  2. Written by Bruno Haible <haible@clisp.cons.org>, 2001.
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 2, or (at your option)
  6. any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software Foundation,
  13. Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  14. #ifndef _STDBOOL_H
  15. #define _STDBOOL_H
  16. /* ISO C 99 <stdbool.h> for platforms that lack it. */
  17. /* 7.16. Boolean type and values */
  18. /* BeOS <sys/socket.h> already #defines false 0, true 1. We use the same
  19. definitions below, but temporarily we have to #undef them. */
  20. #ifdef __BEOS__
  21. # undef false
  22. # undef true
  23. #endif
  24. /* For the sake of symbolic names in gdb, define _Bool as an enum type. */
  25. #ifndef __cplusplus
  26. typedef enum { false = 0, true = 1 } _Bool;
  27. #else
  28. typedef bool _Bool;
  29. #endif
  30. #define bool _Bool
  31. /* The other macros must be usable in preprocessor directives. */
  32. #define false 0
  33. #define true 1
  34. #define __bool_true_false_are_defined 1
  35. #endif /* _STDBOOL_H */