Am Sam, 15 Apr 2000 schrieben Sie:
> On Sat, 15 Apr 2000, Tomasz Motylewski wrote:
>
> :
> : This is a follow up on a private mail exchange about C++ and C user space
> : programs seeing diferent things in the same mbuff shared area.
> This all can be simply explained. The type 'bool' exists in c++ internaly
> or defined as the 'char' type in some header, but in plain c the
> 'bool' type is undefined, so you _have_ to typedef it from some type. In
> your case 'bool' type was defined from 'int' type, included from some
> mbuff header. The simple solution is to use/define your own type like :
>
> typedef unsigned char Bool;
> ....
Yes, this is one way. (I guess the best way at moment). I included the
stdbool.h inside the c-program and assumed that this have the same size as it
used inside C++ program. Both are Gnu C/C++, but it seems there are
strange difference between bool on GNU C++/C:
So the best way is the way how did you suggested. Anyway is there a performance
factor to use unsigned char versus unsigned int ? I believe to remember that
one should use basic types (int and double) on performance programs ? Any
experience? I compiled the kernel program (written in C) with -align-double etc.
Thanks Olaf
/usr/lib/gcc-lib/i486-linux/egcs-2.91.66/include/stdbool.h
/* stdbool.h for GNU. */
#ifndef __STDBOOL_H__
#define __STDBOOL_H__ 1
/* The type `bool' must promote to `int' or `unsigned int'. The constants
`true' and `false' must have the value 0 and 1 respectively. */
typedef enum
{
false = 0,
true = 1
} bool;
/* The names `true' and `false' must also be made available as macros. */
#define false false
#define true true
/* Signal that all the definitions are present. */
#define __bool_true_false_are_defined 1
#endif /* stdbool.h */
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
---
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/