void f(int x)
{
        char c = x ? '|' : '/';
}


$ cc1: warnings being treated as errors
char.c: In function 'f':
char.c:3: error: conversion to 'char' from 'int' may alter its value
Exit 1

If I replace 'x' with a constant (0 or 1) in the condition, then the code compiles.
I think gcc should be smarter here.

--
Andriy Gapon

Reply via email to