Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

warn_unused_result attribute works in C++ but not C?

nemequFeb 23 2018 — edited Feb 27 2018

I just noticed that sunCC in 12.6 supports the warn_unused_result attribute (yay!), but not suncc. It seems like an odd restriction; is it intentional?

Quick test case:

__attribute__((__warn_unused_result__))

int test_unused_result(void) {

  return 1729;

}

int main(int argc, char* argv[]) {

  (void) argc;

  (void) argv;

  test_unused_result();

  if (test_unused_result() != 1729)

    return EXIT_FAILURE;

  return EXIT_SUCCESS;

}

This post has been answered by Maxim Kartashev-Oracle on Feb 26 2018
Jump to Answer

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Mar 27 2018
Added on Feb 23 2018
3 comments
1,037 views