- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- aCC emits warning about return value variable bein...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2016 10:43 AM
03-21-2016 10:43 AM
aCC emits warning about return value variable being set but not used
I have found an issue in aCC. I am using version:
aCC: HP C/aC++ B3910B A.06.28.01 [Aug 09 2014]
Given this test case
class B { public: struct A { A(): a_(0) {}; void* a_; }; }; class F { public: B::A getA() { B::A ret; return ret; } }; B::A get() { F f; B::A theA = f.getA(); return theA; }
compiled with this call:
aCC +DD64 +w +std=c++11 -c t.cpp
I see the following warning emitted
"t.cpp", line 30: remark #2550-D: variable "theA" was set but never used B::A theA = f.getA();
However because "theA" is the return value it is legal for it to be set but not used. I feel this warning is an error on the compilers part.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2016 01:15 AM
03-26-2016 01:15 AM
Re: aCC emits renark about return value variable being set but not used
>"theA" is the return value it is legal for it to be set but not used. I feel this warning is an error on the compilers part.
(This has nothing to do with "legal" but with coding style.)
Looks like a minor bug to me but you asked for it by using +w. :-)
I only see it with +w and +std=c++11, not sure the connection.
And if it was due to the NRV optimization, that should do the warning check before the optimization and +nonrv didn't turn it off.