This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c/10036: new keyword "boolif" that accepts only <stdbool.h>bool values "true" or "false" as arguments; comparison operators that return <stdbool.h>bool values.
- From: roland dot illig at gmx dot de
- To: gcc-gnats at gcc dot gnu dot org
- Date: 12 Mar 2003 10:21:21 -0000
- Subject: c/10036: new keyword "boolif" that accepts only <stdbool.h>bool values "true" or "false" as arguments; comparison operators that return <stdbool.h>bool values.
- Reply-to: roland dot illig at gmx dot de
>Number: 10036
>Category: c
>Synopsis: new keyword "boolif" that accepts only <stdbool.h>bool values "true" or "false" as arguments; comparison operators that return <stdbool.h>bool values.
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Wed Mar 12 10:26:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: roland dot illig at gmx dot de
>Release: unknown-1.0
>Organization:
>Environment:
any
>Description:
#include <stdbool.h>
/* let === be an equality operator whose type is (any,any)->bool. */
int main(void)
{
int a = 12345;
int b = -12345;
boolif (a - b === 0) {
printf("ok\n");
} else {
printf("not ok\n");
}
boolif (a) { /* this shall lead to a compiler error */
printf("12345 == true\n");
} else {
printf("12345 != true\n");
}
}
The strict-bool type shall have no implicit conversion rules from or to other types. The only way to get a strict-bool is the application of the strict-bool operators.
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: