- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: aCC warnings when end of function reached with...
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
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
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
тАО11-21-2003 04:51 AM
тАО11-21-2003 04:51 AM
how can I get aCC (v 3.50) to warn when it encounters the following situation (no return).
Any help much appreciated.
Thanks
Simon
int f(int i)
{
if (42 == i)
{
return i;
}
else
{
cout << "not returning" << endl;
// return nothing
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-22-2003 12:53 AM
тАО11-22-2003 12:53 AM
Re: aCC warnings when end of function reached without a return?
a int function return always a value; in c (R&K and ANSI) doesn't exist NULL value for int.
However I use code like follow:
#define NULLINT 0x80000000
int f(int i)
{ if (i==42) /* Test my value */
return (i); /* return valid value */
else
return (NULLINT); /* invalid value */
}
In this example I suppose 32bit int; you could set a value 0x08 followed by zero until pad the size.
Also your caller code must be recognize the NULLINT value (for example):
i=f(10);
if (i==NULLINT)
/* here do noting */
If you ise ANSIC you could use macro MININT (if I remember);
Notice, in this way, negative vale ha min suca as positive value; for example using 16 bit int your valid value are -32678..32767; using my hint valid value are -32767..32767 because -32768 id NULL value.
H.T.H.
Antoniov
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-24-2003 06:51 AM
тАО11-24-2003 06:51 AM
Re: aCC warnings when end of function reached without a return?
Simon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-24-2003 08:17 AM
тАО11-24-2003 08:17 AM
Solutionhttp://www.gimpel.com/html/flex.htm
It would be quite easy to add a FlexeLint call to all your makefiles before invoking aCC.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-24-2003 08:52 AM
тАО11-24-2003 08:52 AM
Re: aCC warnings when end of function reached without a return?
Ironically, g++ -Wall -pedantic -ansi flags this, as does VC++.
Why doesn't aCC? It's infuriating!!!! And it took a helluva lot of time to track down the behavioural differenced between static and dynamic builds.
Can anyone from HP answer?
Thanks
Simon