MS extend C++ significantly for Windows8... and Andrei got name drop

Manu turkeyman at gmail.com
Thu Jan 26 00:30:14 PST 2012


On 26 January 2012 03:15, Adam Wilson <flyboynw at gmail.com> wrote:

> On Wed, 25 Jan 2012 15:05:43 -0800, Manu <turkeyman at gmail.com> wrote:
>
>  On 26 January 2012 00:55, Adam Wilson <flyboynw at gmail.com> wrote:
>>
>>  On Wed, 25 Jan 2012 14:44:09 -0800, Manu <turkeyman at gmail.com> wrote:
>>>
>>>  On 26 January 2012 00:37, Adam Wilson <flyboynw at gmail.com> wrote:
>>>
>>>>
>>>>  On Wed, 25 Jan 2012 14:28:46 -0800, Manu <turkeyman at gmail.com> wrote:
>>>>
>>>>>
>>>>>  On 25 January 2012 23:59, Adam Wilson <flyboynw at gmail.com> wrote:
>>>>>
>>>>>
>>>>>>  On Wed, 25 Jan 2012 13:35:38 -0800, Manu <turkeyman at gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>
>>>>>>>  On 25 January 2012 21:47, bls <bizprac at orange.fr> wrote:
>>>>>>>
>>>>>>>
>>>>>>>   On 01/25/2012 07:03 AM, Manu wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>   This is fairly interesting. MS have extended their C++ compiler
>>>>>>>>>
>>>>>>>>>  significantly for Windows8 with a bunch of non-standard stuff.
>>>>>>>>>
>>>>>>>>>> FINALLY implement garbage collection, ref counting, properties,
>>>>>>>>>> delegates, events, generics, etc...
>>>>>>>>>> If other compilers adopt this tech, D loses some advantages.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>  But you still have to fight with ifndef ,forward declaration,
>>>>>>>>>> and a
>>>>>>>>>>
>>>>>>>>>>  template syntax against common sense.  Even if you paint shit
>>>>>>>>> yellow
>>>>>>>>> it's
>>>>>>>>> not necessarily gold.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>  True, but I think this will mitigate a lot of the motivation
>>>>>>>>> Windows
>>>>>>>>>
>>>>>>>>>  devs
>>>>>>>> have to seek another language if they're not developing cross
>>>>>>>> platform
>>>>>>>> apps.
>>>>>>>>
>>>>>>>> Sadly, since WinRT requires using these language extensions to
>>>>>>>> interface
>>>>>>>> with the new windows runtime, you won't be able to write a Windows8
>>>>>>>> app
>>>>>>>> in
>>>>>>>> D.
>>>>>>>> Interestingly though, D supports almost everything they've added to
>>>>>>>> C++. I
>>>>>>>> wonder if it would be possible to do extern(Windows8) to produce a
>>>>>>>> compatible ABI for linking with MS C++ apps?
>>>>>>>>
>>>>>>>> The most interesting features are 'ref new' and 'gcnew', which makes
>>>>>>>> me
>>>>>>>> wonder, since Windows8 has an OS garbage collector, would it be at
>>>>>>>> all
>>>>>>>> possible to have D use the Windows8 GC? I'd prefer this to using D's
>>>>>>>> own
>>>>>>>> GC
>>>>>>>> if it would be supported, and obviously this would be a requirement
>>>>>>>> if D
>>>>>>>> was going to interact with WinRT properly.
>>>>>>>> Also, WinRT uses 'ref new' to allocate ref counted (effectively COM
>>>>>>>> to
>>>>>>>> my
>>>>>>>> understanding) objects. I think I read somewhere that D already has
>>>>>>>> extern(COM) no? I wonder if Windows8 ref type linkage is already
>>>>>>>> technically supported in D?
>>>>>>>>
>>>>>>>>
>>>>>>>>  There is no Win8GC, it's all ref counted. WinRT is COM with extras
>>>>>>>>
>>>>>>> and as
>>>>>>> such should be accessible to D. It would need some extra glue code
>>>>>>> over
>>>>>>> what we have now ... like the IInspectable interface.
>>>>>>>
>>>>>>>
>>>>>>>  Really? So what's 'gcnew' for?
>>>>>>>
>>>>>>
>>>>>>
>>>>>>  That's for targeting the CLR (.NET) so it doesn't conflict with
>>>>> new/delete
>>>>> in regular C++. It goes all the way back to the first C++/CLI in Visual
>>>>> Studio 2005.
>>>>> http://msdn.microsoft.com/en-******us/library/te3ecsc8.aspx<http://msdn.microsoft.com/en-****us/library/te3ecsc8.aspx>
>>>>> <ht**tp://msdn.microsoft.com/en-****us/library/te3ecsc8.aspx<http://msdn.microsoft.com/en-**us/library/te3ecsc8.aspx>
>>>>> >
>>>>> <http**://msdn.microsoft.com/**en-us/**library/te3ecsc8.aspx<http://msdn.microsoft.com/en-us/**library/te3ecsc8.aspx>
>>>>> <**http://msdn.microsoft.com/en-**us/library/te3ecsc8.aspx<http://msdn.microsoft.com/en-us/library/te3ecsc8.aspx>
>>>>> >
>>>>> >
>>>>>
>>>>>
>>>>
>>>> So there is a GC... It just happens to be the .net GC. Is that a
>>>> problem?
>>>> Obviously it's accessible in C++ code. Can you use it to allocate C++
>>>> objects, or is it exclusively for some sort of interaction with .net?
>>>> If the rest of the platform is using it...
>>>>
>>>>
>>> It's exclusively for the .NET Framework and requires the .NET Framework
>>> to
>>> be installed and loaded to run. It's the .NET Runtime, and as such, it
>>> would be VERY unwise to base anything D on it.
>>>
>>
>>
>> .NET will be a requirement on all Win8 machines. You didn't answer though,
>> can you use the .NET GC to allocate C++ objects to use throughout your
>> native program? Or is gcnew strictly for interfacing C++ with .NET, like
>> C++/CLI?
>>
>
> It is strictly for allocating .NET objects. You CANNOT allocate C++
> objects with the .NET GC, that was implied by the statement on the use of
> the .NET GC.


I see, well that's good. I presume then that it shouldn't be too much
trouble to implement MS C++'s ref type ABI in D then if it is just
basically COM.
How about 'delegate'? Would it be trouble to make the extern ABI compatible
when passing delegates between MSC++/D?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120126/c0006501/attachment-0001.html>


More information about the Digitalmars-d mailing list