removal of cruft from D

Bill Baxter wbaxter at gmail.com
Mon Nov 23 12:15:17 PST 2009


On Mon, Nov 23, 2009 at 12:04 PM, Pelle Månsson <pelle.mansson at gmail.com> wrote:
> dsimcha wrote:
>>
>> == Quote from retard (re at tard.com.invalid)'s article
>>>
>>> Mon, 23 Nov 2009 17:14:54 +0000, dsimcha wrote:
>>> [snip]
>>>>
>>>> as opposed to the
>>>> Java way of having to use 5 different classes just to read in a file
>>>> line by line in the default character encoding.
>>>
>>> That's a library issue. Has nothing to do with the language.
>>
>> I agree completely, but for all practical purposes basic parts of the
>> standard
>> library that are used by almost everyone are part of the language.  Heck,
>> in many
>> languages (D being one of them) you can't even write a canonical hello
>> world
>> program w/o the standard lib.
>
> Sure you can!
>
> extern (C) int puts(char *);
> void main() {
>    puts("Hello world!\0".dup.ptr);
> }

I think he means that the GC from the standard lib will still be there
to perform that .dup for you.
(You don't need the dup though, btw, string literals are null
terminated and can be passed to C funcs as-is).

Even without that, the GC doesn't get eliminated from executables just
because you don't use it.
There's still some hidden calls to gc init routines that go into any D exe.

--bb



More information about the Digitalmars-d mailing list