473,405 Members | 2,279 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

reporting error from function

hi all,
When the processing error is more than two, than which approach is better(as mentioned below):

Say the error may be
ERR_A
ERR_B
ERR_C
ERR_D

1) one approach could be function it self return the error code and it is the responsibility of caller to intialize the error.
2) Another the function return either bool or void and the function itself set the error. As we do in the C for example in the case of file open

please suggest pros and cons..
Laxman Singh
Sep 7 '06 #1
2 1883
I don't know whether you are talking about standard APIs or user defined functions.

In case of standard APIs, if the API fails, the API will set corresponding the error values (if any defined in the manual page for that API) to the variable "errno" which is defined in the header file error.h.

In case of user defined functions, we can not return more than one value. So if we expecting four error values and one return value from a function, we have to pass the reference of four local variables to the function as arguments.
Sep 7 '06 #2
I don't know whether you are talking about standard APIs or user defined functions.

In case of standard APIs, if the API fails, the API will set corresponding the error values (if any defined in the manual page for that API) to the variable "errno" which is defined in the header file error.h.

In case of user defined functions, we can not return more than one value. So if we expecting four error values and one return value from a function, we have to pass the reference of four local variables to the function as arguments.

**
As approach is concern how it is differ for standard API and user defined function. In user defined function also you can use unique error codes(declared one of the header file) and those error code could be return or set to some global variable (say cn_error).

why can i not return more than one value from user defined function ? Because if my return type is 'unsigned char' then i could able to return multiple error codes by simply returning (i.e. return ERR_A).

please suggest some pros and cons.

Laxman Singh
Sep 7 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Oliver Spiesshofer | last post by:
Hi, I have set in my .htaccess file php_flag error_reporting 2047 to prevent error output to users. However, in some selected scripts I want to allow errors to be shown. I tried several...
1
by: Shabam | last post by:
If the host has turned off error reporting in php.ini and I'm not able to override it, what recourse do I have to debug my php scripts?
5
by: steve | last post by:
Hi, In my script (phpnuke), whenever there is access to database, there is this line of code: message_die(GENERAL_ERROR, ’some error msg’, ’’, __LINE__, __FILE__, $sql); Is there a more...
4
by: Fabian von Romberg | last post by:
Hi, I have installed Sql Reporting Services on 2 machines, one is WIN 2000 PRO and the other one is WIN 2000 ADV. SERVER. When I try to access a report using the webbrowser, I get the following...
0
by: Joshua V. | last post by:
We are trying to implement Windows Error Reporting from within our VB.Net application. Basically we want to replace the standard unhandled exception message we use with the Windows Error Reporting...
2
by: RdS | last post by:
Hello, I use sourcesafe and vb 2003 for my dev environment. on the sourcesafe server I also have sql2005 and reporting services installed. The web app references this sql server for db. When...
1
by: rmk | last post by:
How can I get the 2000 and 2005 versions of SQL Server Reporting Services both working on my development laptop ????? I have ASP.NET 1.1 and 2.0 installed on my laptop. I have Visual Studio...
2
by: petermichaux | last post by:
Hi, It seems like determining element position in a web page is a difficult task. In the position reporting source code I've looked at there are special fixes for at least some versions of...
8
by: Paul Furman | last post by:
How do I turn off MySQL error reporting? I set error_reporting(0); but that doesn't seem to be working.
0
by: fperri | last post by:
Hi, I am trying to configure reporting services which I just added to an already existing installation of SQL Server 2005. When I am in the reporting services configuration manager and I am trying...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.