On 14 September 2013 22:58, H. S. Teoh <[email protected]> wrote:
> On Sat, Sep 14, 2013 at 08:04:10PM +0100, Iain Buclaw wrote:
>> On 14 September 2013 19:47, Nick Sabalausky
>> <[email protected]> wrote:
>> > On Sat, 14 Sep 2013 13:14:09 +0200
>> > Joseph Rushton Wakeling <[email protected]> wrote:
>> >
>> >> On 14/09/13 00:51, Justin Whear wrote:
>> >> > Just ran across this: http://www.zimbu.org/
>> >> > A language by Bram Moolenaar (original author and maintainer of
>> >> > vim). The "Why Zimbu?" section on the right side of the homepage
>> >> > has comparisons to other languages. D is the last comparison,
>> >> > suggesting that it meets all the other qualifications but fails
>> >> > on "It has to run on most systems, anything with a C compiler, so
>> >> > D is out."
>> >>
>> >> Theoretically, shouldn't GDC be able to support just about any
>> >> architecture for which GCC has a backend? The runtime and Phobos
>> >> need porting, but the core language itself should be usable, no?
>> >
>> > And doesn't LLVM have a way to compile D *to* C?
>> >
>>
>> If it did, there would be quite a few bits missing as much of D can
>> not be easily represented in C.
> [...]
>
> Really? Example? I thought *anything* can be reduced to C, given enough
> implementational abstractions.
>
>
> T
>
> --
> What do you mean the Internet isn't filled with subliminal messages? What
> about all those buttons marked "submit"??
Exceptions are one such example. In gcc codegen, they are reduced to
essentially:
trybody:
Array __tmp1 = { .length = 5, .ptr = "foo.c"; };
Array __tmp2 = { .length = 3, .ptr = "Die"; };
Object & o = _d_newclass (&_D9Exception7__ClassZ);
Exception & _e = __ctor (o, __tmp2, __tmp1, 8, 0);
_d_throw (e);
finally:
return 0;
int ehf = __builtin_eh_filter (1);
switch (ehf)
{
case 1:
goto catchbody;
default:
goto catch;
}
catch:
void * ehp = __builtin_eh_pointer (1);
__builtin_unwind_resume (ehp;
catchbody:
o = *(__builtin_eh_pointer (1) + 18446744073709551608);
e = _d_dynamic_cast (o, &_D9Exception7__ClassZ);
goto finally;
}
Which doesn't have any natural flow between eh_filter() and _d_throw().
--
Iain Buclaw
*(p < e ? p++ : p) = (c & 0x0f) + '0';