pointers, functions, and uniform call syntax
Regan Heath
regan at netmail.co.nz
Tue Sep 4 02:14:22 PDT 2012
On Mon, 03 Sep 2012 21:04:56 +0100, Era Scarecrow <rtcvb32 at yahoo.com>
wrote:
> On Monday, 3 September 2012 at 18:45:42 UTC, Jonathan M Davis wrote:
>> However, one thing to remember that complicates this a bit is that it's
>> perfectly possible to declare a function which is overloaded with one
>> function taking a pointer and one not.
>>
>> void func(S* s, int i) {...}
>> void func(S s, int i) {...}
>>
>> in which case, there's an ambiguity, and I would then expect UFCS to
>> _not_ compile when using S*, or you'd risk function call hijacking.
>> That's not necessarily a big deal, but it _does_ complicate things a
>> bit.
>>
>> - Jonathan M Davis
>
> I think moreso is would if it would convert to ref automatically or
> not rather than worry about pointers. True if you wanted all three, then
> the language has to keep them all distinctly different; But if it
> silently converts it should be okay (so long as constness/immutable is
> honored). Assuming that's the case:
>
> //these two effectively identical
> void func(S* s, int i) {...}
> void func(ref S s, int i) {...}
What if the first function is in library A and the 2nd function in library
B and they do two totally different things?
R
--
Using Opera's revolutionary email client: http://www.opera.com/mail/
More information about the Digitalmars-d
mailing list