comp.lang.ada
 help / color / mirror / Atom feed
From: "Frank J. Lhota" <NOSPAM.lhota.adarose@verizon.net>
Subject: Re: Compiler error: 'Expect procedure name in procedure call'
Date: Tue, 05 Nov 2002 22:15:27 GMT
Date: 2002-11-05T22:15:27+00:00	[thread overview]
Message-ID: <3qXx9.22224$t1.12313@nwrddc02.gnilink.net> (raw)
In-Reply-To: usmyhrqkk.fsf@gsfc.nasa.gov

"Stephen Leake" <stephen.a.leake.1@gsfc.nasa.gov> wrote in message
news:usmyhrqkk.fsf@gsfc.nasa.gov...
> For most C functions, I agree with this. However, for the specific
> case of Win32 C functions, many have a return value which is _defined_
> to be "TRUE", and many others have no documentation on what the return
> value might be.  This is a side effect of the C compilers letting you
> ignore return values; the Win32 authors apparently said something like
> "Well, this return value is pretty meaningless, but people can always
> ignore it, and we have a coding standard that says 'return a value'"
> :).

Actually, most Win32 functions have the return type BOOL, a signed 32 bit
integer type. The Win32 header <windef.h> define two BOOL constants, FALSE
(0) and TRUE (1). The Win32 convention is that these functions with BOOL
return values will return FALSE if the function call failed. Now conversely,
you would think that these functions would return TRUE when they succeed,
but unfortunately this is not the case. Many Win32 functions will sometimes
return non-zero BOOL values other than TRUE to indicate success. This is one
of the more annoying Win32 "got-chas". One consequence of this "got-cha" is
that, independent of which language you are programming in, NEVER do error
checking by comparing a Win32 function return value to TRUE.

Another Win32 "got-cha" occurs with the Win32 functions that return a
HANDLE. Some of these functions indicate an error by returning
INVALID_HANDLE_VALUE (-1), while others will indicate an error by returning
a NULL (0) handle. Apparently there was a paradigm shift in the middle of
the design of the Win32 API, but this inconsistency does create confusion
for the legions of Win32 programmer.

And don't get me started on the WinSock API, the quirky Win32 adaptation of
Berkeley sockets that manages to be annoyingly inconsistent with either
POSIX standards or with the rest of the Win32 API.





  reply	other threads:[~2002-11-05 22:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-04 15:05 Compiler error: 'Expect procedure name in procedure call' Jon
2002-11-04 15:35 ` Stephen Leake
2002-11-04 19:57   ` Jon
2002-11-04 20:35     ` Björn Lundin
2002-11-04 20:53       ` Björn Lundin
2002-11-04 20:48     ` Jim Rogers
2002-11-04 21:08       ` Stephen Leake
2002-11-05 22:15         ` Frank J. Lhota [this message]
2002-11-05 20:51       ` Programmer Dude
2002-11-06 15:06         ` Ted Dennison
2002-11-04 21:40     ` Vinzent Hoefler
2002-11-05  9:29       ` Jon
2002-11-05  9:55         ` Dale Stanbrough
2002-11-06 23:29         ` Randy Brukardt
2002-11-05 14:22     ` Ted Dennison
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox