`ref T` should be a type!!

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Apr 4 11:14:36 UTC 2019


On 4/4/19 4:33 AM, Manu wrote:
> On Tue, Apr 2, 2019 at 4:10 AM Andrei Alexandrescu via Digitalmars-d
> <digitalmars-d at puremagic.com> wrote:
>>
>> On 4/2/19 4:11 AM, Walter Bright wrote:
>>> On 4/1/2019 5:55 PM, Atila Neves wrote:
>>>> Factually incorrect.
>>>
>>> I suspect Rubn has confused the syntactical conflation of arrays with
>>> pointers in C, and the implicit coercion of arrays to pointers, as them
>>> being the same. They simply aren't the same, as they are semantically
>>> separated by one level of indirection.
>>
>> You forgot to mention that top-level "const" is ignored in function
>> parameters (for the signature and mangling but not the implementation).
> 
> Actually, it's sadly not ignored, and MSVC mangles it!

I'd be surprised. It would be a gross bug. It didn't in 2004 when I 
still was using it. Herb advocates using top-level const in 
implementation, pointing out that it's ignored in the signature.

> It's been a
> massive PITA when writing some of the STL bindings in druntime!
> I've had to manually build mangled function names to extern, because I
> can't express it in D >_<
> 
> https://github.com/dlang/druntime/blob/master/src/core/stdcpp/allocator.d#L50
>   <- you're loving it!

Could that be a "pointer to const"? That's not top-level.



More information about the Digitalmars-d mailing list