Ben Bacarisse wrote:
> jacob navia <jacob@[EMAIL PROTECTED]
> writes:
>
>> Keith Thompson wrote:
>> [snip]
>>
>>> What could be done, I suppose, is to add an entirely new array-like
>>> construct to C, one that doesn't depend on pointer semantics for its
>>> fundamental operations or decay to a pointer in most contexts. Let's
>>> call it a "vector".
>> Correct. This is the way that lcc-win has choosen. Using
>> operator overloading of the '[' and ']' operators lcc-win
>> offers a true array type that doesn't "decay" to anything.
>
> Way off-topic now so I've set followup-to comp.compilers.lcc, but I
> can't see how that can do anything. In this code:
>
> int a[10];
> f(a);
>
> there are no [] operators, so how does the compiler know which sort of
> array I want?
>
Because you tell it to:
int a[10]; // Normal C array
Vector v = newVector(10,sizeof(int));
a[2] = 5;
v[2] = 5;
> <snip>
>> ... Operator overloading provides a simple and elegant solution as
>> I have been claiming since several years now.
>
> I think treating initialisation as assignment and, if I recall
> correctly, *not* treating argument passing as assignment makes your
> operator overloading much less useful than it might have been.
>
All argument passing are assignments in standard C.
But if you want C++, no, it is not C++.
--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32


|