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.

roland.illig@gmx.de roland.illig@gmx.de
Wed Mar 12 11:08:00 GMT 2003


>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.illig@gmx.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:



More information about the Gcc-bugs mailing list