VC8 Compiler bizarreness
- From: Murrgon <murrgon@xxxxxxxxxxx>
- Date: Tue, 03 Jun 2008 14:03:41 -0400
class TTexture;
typedef TSmartPtr<TTexture> TTexturePtr;
typedef TArray<TTexturePtr> TTexturePtrArray;
TTexturePtrArray apTextures;
I am having the most bizarre compiler error. Code that has been working
for years all of a sudden, in one particular case, throws a compiler
error:
for (UINT i = 0; apTextures.Size() > i; ++i)
{
if (NULL != apTextures[i])
{
// Do something
}
}
error C2593: 'operator !=' is ambiguous
As this is dealing with templates, the compiler comes along and tells you
what types it thinks might fit. The weird part is, none of the suggested
types have anything to do with a TTexture. What? I don't know how the
compiler resolves the types, but something is messed up.
I can get around the problem by either typecasting NULL to a TTexture* or
reversing the order of the comparison (i.e. apTextures[i] != NULL), but I
shouldn't need to. This code is used in countless other instances and
all of them compile just fine.
Murrgon
.
- Follow-Ups:
- Re: VC8 Compiler bizarreness
- From: Bo Persson
- Re: VC8 Compiler bizarreness
- Prev by Date: Re: Order of evaluation of expression
- Next by Date: Re: VC8 Compiler bizarreness
- Previous by thread: Order of evaluation of expression
- Next by thread: Re: VC8 Compiler bizarreness
- Index(es):
Loading