473,597 Members | 2,157 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Convention for C functions success/failure

Hello,

What is the convention for writing C functions which don't return a
value, but can fail?

If I understand correctly,
1. PyArg_ParseTupl e returns 0 on failure and 1 on success.
2. PySet_Add returns -1 on failure and 0 on success.

Am I correct? What should I do with new C functions that I write?

Thanks,
Noam

Dec 3 '05 #1
0 1141

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2308
by: Asapi | last post by:
1. Are linkage convention and calling convention referring to the same thing? 2. Does calling convention differ between languages C and C++? 3. How does calling convention differ between static and non-static class member function? 4. Could it be possible to specify different calling convention for each "global" or each class member function? Even in a single file scope?
27
2654
by: Maximus | last post by:
Hi, I was just wondering, is it good to use return without arguments in a void function as following: void SetMapLayer() { if( !Map ) return; layer = LAYER_MAP; }
7
2258
by: BlueDragon | last post by:
The place where I work is moving to MS SQL Server from Lotus Notes. I have done a lot of coding in Lotus Notes, and have, I suppose, intermediate skills in basic SQL -- queries, insert, updates, table design, etc. I have a couple of questions, however. First, stored procedures vs. functions. In my world, a function is a body of code that returns a value; a procedure is a body of code that does things but does not return a value (other than...
4
3209
by: Bilgehan.Balban | last post by:
Hi, Generally in my C code, I use the following convention to return success or failure: a) For functions that return a pointer, (allocation, filling-in a structure etc.) return Null for all errors, and the appropriate pointer for success. b) For functions that checks for a condition such as is_working() etc.
8
1322
by: Lau Lei Cheong | last post by:
Hello, As a programmer, I'm sure many of you have written libraries to do many of the repeatative tasks, and possibly sharing them with other team members. In my case, I have about a dozen functions in hand that are either "not completely tested" or simply "half done", while another half-dozen functions that'll require another one or two more functions in order to run correctly. Currently, I've marked these functions with XML...
1
2266
by: audipen | last post by:
Hi, I trap the 'OnBuildProjConfigDone' and perform some custom enhancement to the assembly. I check the 'bool Success' parameter before I perform my step. I go ahead only if 'Success == true" My question is - Is there any way in which I can indicate success or failure of my post build step.. 'Success' is an in-parameter, so I cant set it to false. Also the return type of the handler is void.
0
1734
by: Carl Colijn | last post by:
Hi all, Disclaimer: before I might trigger your "let's start a holy war!" button, I'd like to say I'm not intended to; I just post this message to get some input and not to promote "Yet Another Naming Convention". It's a bit of a long post, but I've spent the past few days on perfecting this, finally came to the conclusion that maybe I went a bit overboard with it, almost willing to just say "the @#$ with it" but I didn't want to let it...
6
11565
by: Ole Nielsby | last post by:
VC has a __cdecl specifier which allows functions and methods to be called with varying parameter count. (I understand this is the default for functions in general but in VC, instances use another convention unless they have an ellipsis argument.) I can force GCC and other compilers to use such a convention by declaring all methods with an ellipsis, but I'd rather not clutter my method definitions with these.
0
7965
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7885
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8271
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8380
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6686
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5426
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3881
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3923
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2399
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.