Unary arithmetic operators

suggest change

The unary + and - operators require an arithmetic operand. Applying either one to a structure is a constraint violation, so the compiler must issue a diagnostic:

#include <stdbool.h>

struct foo
{
    bool bar;
};

void baz(void)
{
   struct foo testStruct;
   -testStruct; /* This breaks the constraint so must produce a diagnostic */
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents