Site Tools


wiki:h-iso646

Table of Contents

<iso646.h>

<iso646.h> provides alternative spellings for operators as macros: and for &&, or for ||, not for !, bitand for &, etc. It exists for platforms where these symbols were assigned to other characters.

In C++, these are built-in keywords; in C, you need this header. Rarely needed on modern systems.

Example

This example uses operator alternative spellings to demonstrate they work identically to symbols.

// compile: gcc -o iso646example iso646example.c
// run: ./iso646example
// description: use iso646.h operator alternatives
 
#include <iso646.h>
#include <stdio.h>
 
int main() {
    int a = 1, b = 0;
 
    if (a and not b)
        printf("a is true and b is false\n");
 
    unsigned x = 0xFF;
    unsigned y = x bitand 0x0F;
    unsigned z = y bitor 0xF0;
    printf("x=0x%02X  y=0x%02X  z=0x%02X\n", x, y, z);
 
    return 0;
}
wiki/h-iso646.md · Last modified: by 127.0.0.1