MCPcopy Create free account
hub / github.com/csmith-project/csmith / Output

Method Output

src/Constant.cpp:531–552  ·  view source on GitHub ↗

* */

Source from the content-addressed store, hash-verified

529 *
530 */
531void
532Constant::Output(std::ostream &out) const
533{
534 //enclose negative numbers in parenthesis to avoid syntax errors such as "--8"
535 if (!value.empty() && value[0] == '-') {
536 output_cast(out);
537 out << "(" << value << ")";
538 } else if (type->eType == ePointer && equals(0)){
539 // don't output cast for NULL:
540 if (CGOptions::lang_cpp()) {
541 if (CGOptions::cpp11())
542 out << "nullptr";
543 else
544 out << "NULL";
545 } else {
546 out << "(void*)" << value;
547 }
548 } else {
549 output_cast(out);
550 out << value;
551 }
552}
553
554///////////////////////////////////////////////////////////////////////////////
555

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected