◆ P99_RVAL

#define P99_RVAL (   T,

Define an rvalue of type T and (if given) value VAL.

Tmust be a type that can serve as an rvalue, but see below.
VALcan be omitted. If given it must be assignment compatible to T. If omitted, an rvalue of type T with default initialization is produced.

In a way this is a "safer" cast operation. E.g

void f(double* x);
void f(double x);
int a = 32;
g(P99_RVAL(double, a)); // essentially the same as previous
f((double*)&a); // no warning is produced
f(P99_RVAL(double*, &a)); // warning: assignment from incompatible pointer type
T must be a type to which a value can be assigned. This excludes function types and array types. It does not exclude pointers to function types or array types, but unfortunately for syntactic reasons these two only work if T is a typedef to that pointer type.
See also
P99_AVAL for an array type with unknown base type.
P99_LVAL for a macro that returns an lvalue.

Definition at line 1121 of file p99_int.h.

Definition: p99_str.h:138
#define P99_RVAL(T, VAL)
Define an rvalue of type T and (if given) value VAL.
Definition: p99_int.h:1121