Sure Mats,
It is allowed. Here is the code. Any comments?
Code:
__interface IFoo {
public:
virtual int foo ([unique] char *ptr1, [unique] char *ptr2) = 0;
};
class Foo : public IFoo {
public:
int foo (char *ptr1, char *ptr2)
{
char array1[] = "Hello";
ptr1 = array1;
ptr2 = array1; // should be wrong, no aliasing allowed, but compile and run ok
return 0;
}
};
int main()
{
char* ptr1 = 0;
char* ptr2 = 0;
Foo f;
// f.foo(ptr1, ptr2);
f.foo(ptr1, ptr1);
return 0;
}
Originally Posted by
matsp
Yes, try passing in the same pointer (value) for both arguments to foo() instead, and see if that's detected.
--
Mats
regards,
George