if (!pPlayer || !pPlayer-IsNetClient())
Why does this logic crash a linux dedicated server?
Cheers,
James
---
James Couzens
ClanMod Dev Team
WWW: http://unitedadmins.com/clanmod.php
UA LISTS: http://list.unitedadmins.com/mailman/listinfo
___
To
hmm, if pPlayer = NULL then you can´t do pPlayer-IsNetClient()..
- Original Message -
From: James Couzens [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, June 07, 2003 9:22 PM
Subject: [hlcoders] SDK line crashing linux servers
if (!pPlayer || !pPlayer-IsNetClient())
Why
If pPlayer is NULL, then !pPlayer will return true, in which case the
second part of the or statement will not get evaluated, so that's not the
problem.
Persuter
At 10:02 PM 6/8/2003 +0200, you wrote:
hmm, if pPlayer = NULL then you can´t do pPlayer-IsNetClient()..
- Original Message -
You cannot assume that it is not evaluated. Maybe the compiler compiles the
code is such a way both get checked anyways. Or maybe the compiler copiles
it so the second statement gets checked first. You -never- know for sure, so
you should be explicit about it. I would do it this way (please note I
No, the C++ specification is such that it always evaluates conditions
in a
lazy manner from left to right.
Persuter
How about, try it his way, and if it works, curse the specification?
--
MoD.
___
To unsubscribe, edit your list
All I know, is that, that line of code is littered throughout the SDK in the
util functions, so I figured it was safe to use, but after some looking, its
definately the guilty party, but only on my linux bins. There are of course
other ways around it, but just frustrating to have that code fail
If the pPlayer pointer is invalid (not initialized) but not NULL then it
can cause a crash.
On Sat, 7 Jun 2003 17:51:38 -0700, James Couzens [EMAIL PROTECTED]
wrote:
All I know, is that, that line of code is littered throughout the SDK in
the
util functions, so I figured it was safe to use, but
It's good practice to initialise your variables when you create them. If
you don't it may be holding bogus data, therefore not reporting NULL however
at the same time, not doing what you want it to do.
In your instance, if pPlayer points to *something* but not a valid CBP
class, then the first
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Sat, Jun 07, 2003 at 12:22:19PM -0700, James Couzens wrote:
if (!pPlayer || !pPlayer-IsNetClient())
Why does this logic crash a linux dedicated server?
I'm assuming you're using MSVC on windows. If so, MSVC does not
evaluate boolean
This is a multi-part message in MIME format.
--
[ Picked text/plain from multipart/alternative ]
The problem is that the CBasePlayerClass memory has been released, but the pointer is
still around. This typically happens when you have entities owned by a player that
disconnects unexpectantly. The
--
[ Picked text/plain from multipart/alternative ]
At 06:01 PM 6/8/2003 -0400, you wrote:
On Sat, Jun 07, 2003 at 12:22:19PM -0700, James Couzens wrote:
Why does this logic crash a linux dedicated server?
I'm assuming you're using MSVC on windows.
I'm not quite sure that's a safe
I'd say the most likely explanation is indeed shimms' and hofer's
conjecture, i.e., that it has not been initialized. There is no serious
compiler that will not follow the left-to-right rule, that's a fairly
integral part of the C++ specification, which is used a lot (it's used
throughout the HL
Furthermore:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang/html
/_clang_precedence_and_order_of_evaluation.asp
yes, ms follows standards.
omega
Blackened Interactive - http://www.blackened-interactive.com
Wavelength - http://www.thewavelength.net
-Original
Excellent! This was frustrating me to no end. I've simply been trying to
tell if a player is connected or not. As you have indicated, when a player
disconnects, the pointer is still valid or not null. I'll stick the
FREE_PRIVATE(pClient) in the clientDisconnect function and see if it doesn't
14 matches
Mail list logo