removal of cruft from D
retard
re at tard.com.invalid
Mon Nov 23 14:26:14 PST 2009
Tue, 24 Nov 2009 00:21:41 +0300, Denis Koroskin wrote:
> On Mon, 23 Nov 2009 23:04:54 +0300, 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);
>> }
>>
>> Pretty!
>
> Even simpler:
>
> extern (C) int printf(const(char)* str, ...);
>
> void main() {
> printf("Hello, World!");
> }
Or even bettar
void print(string str) {
void _(int addr, int len) {
asm {
mov EAX,0x4;
mov EBX,0x1;
mov ECX, addr;
mov EDX, len;
int 0x80;
}
}
_(cast(int)str.ptr, str.length);
}
void main() {
print("hello world");
}
My asm skills are a bit rusty, though..
In this case dmd2 produces 441x larger executables than nasm :)
More information about the Digitalmars-d
mailing list