ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

Tiny 'Touch' 32 bits program in C (3 kb)

<< < (2/6) > >>

Gerome:
Hi,

...
The C standard defines two macros, EXIT_SUCCESS and EXIT_FAILURE, which can be used as appropriate return values to the operating system. They are respectively 0 and 1.
-Jibz (September 30, 2006, 03:48 AM)
--- End quote ---

I don't sometimes care of what can say the standards...
Why ?
It's simply psychologic and it has a real explanation :
The common 'human' sense would recognize that a 'TRUE' value seems positive, and 'FALSE' the opposite.
So what ?
I've told to my program to execute this_task and it replied to me that there were NO errors singnaled, so the return is TRUE, else in case of failure it would return 0...
And this common human readable/understandable sense can be also found onto 80% of the APIs here and there, where 0 indicates a failure or a NULL return ( example : Findwindow, SleepEx, ... )

Jibz:
The problem with not following the generally accepted standards and conventions is that your program will behave unexpectedly.

If somebody uses your program in a script or makefile they will automatically assume that the return value will be zero on success, so they will be scratching their heads for a while wondering why your program keeps failing until they look at the source and see it.

Gerome:
Hello,

The problem with not following the generally accepted standards and conventions is that your program will behave unexpectedly.
-Jibz (October 01, 2006, 04:17 AM)
--- End quote ---

At first, it seems you did NOT read explanations i gave into my previous post.

If somebody uses your program in a script or makefile they will automatically assume that the return value will be zero on success, so they will be scratching their heads for a while wondering why your program keeps failing until they look at the source and see it.

--- End quote ---

Secondly I gave souces also, and if you don't agree with that, feel free to make your own executable.
At last, there is no way my code lead into crash or alike, the only two return code are 1 in case of success and 0 in case of failure (generally encountered into API calls)
So WTF ?

Jibz:
I am just trying to help and explain, no reason to get angry :Thmbsup:.

Gerome:
Hello,

I am just trying to help and explain, no reason to get angry :Thmbsup:.
-Jibz (October 01, 2006, 06:40 AM)
--- End quote ---

Please i don't need help onto that part.
FYI, i'm a professional system C/C++, ASM, .NET, PLSQL developper, and i love APIs :)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version