Download ARM® Compiler armcc User Guide

Transcript
9 Language Extensions
9.25 ? operator
9.25
? operator
A ? operator whose second and third operands are string literals or wide string literals can be
implicitly converted to char * or wchar_t *.
In C++ string literals are const. There is an implicit conversion that enables conversion of a
string literal to char * or wchar_t *, dropping the const. That conversion, however, applies
only to simple string literals. Permitting it for the result of a ? operation is an extension.
Examples
char *p = x ? "abc" : "def";
ARM DUI0472J
Copyright © 2010-2013 ARM. All rights reserved.
Non-Confidential
9-585