[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [certi-dev] IEEE1516 RIambassador Checking if (&Object == NULL)
From: |
Ijperen, Jeroen van |
Subject: |
RE: [certi-dev] IEEE1516 RIambassador Checking if (&Object == NULL) |
Date: |
Thu, 11 Nov 2010 07:28:53 +0100 |
Hello Eric,
You are right that a (const) reference *should* always refer to an object,
however this is not enforced by the compiler or runtime. So it actually is
possible to dereference a NULL pointer, and pass it as a reference. (To check
for this situation, you request the location of the reference, and compare it
to NULL.) Basically, it's an extra check to make really sure no one passes a
NULL tag (accidentally or on purpose).
Kind regards,
Jeroen v. IJperen
-----Oorspronkelijk bericht-----
Van: address@hidden [mailto:address@hidden Namens Eric Noulard
Verzonden: woensdag 10 november 2010 15:01
Aan: CERTI development discussions
Onderwerp: [certi-dev] IEEE1516 RIambassador Checking if (&Object == NULL)
Hi All,
[may be Jeroen in the first place],
in RTI1516ambassador.cpp there is checking code like:
if ( &theUserSuppliedTag == NULL || theUserSuppliedTag.data() == NULL)
{
throw RTIinternalError(L"Calling updateAttributeValues
with Tag NULL");
}
since 'theUserSuppliedTag' is an argument passed as const reference how could
&theUserSuppliedTag == NULL
ever be true?
Am I missing something?
I think we may just suppress this part of the check, could anyone tell
me if I'm wrong?
--
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
--
CERTI-Devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/certi-devel