flat assembler
Message board for the users of flat assembler.
Index
> High Level Languages > D |
Author |
|
OzzY 18 Nov 2006, 21:30
Quote: D looks very nice, but the presence (and near-enforcing) of the Garbage Collector makes me run away of it for anything really serious. I'm trying D, looks really nice. The Garbage Collector is optional to use. You just turn it on if you want. You still have "new" and "delete", pointers and so on... Plus, D have a nice standard library able to manipulate files, streams, strings, sockets, zip files, base64 enconding, and there are some GUI libraries available. The only downside at my point of view is that the language isn't too popular yet. |
|||
18 Nov 2006, 21:30 |
|
rugxulo 18 Nov 2006, 23:45
Quote:
EDIT: Here's some announcements of other D stuff (and no, I don't program in D, but it looks nice ...) |
|||
18 Nov 2006, 23:45 |
|
Maverick 19 Nov 2006, 12:11
Has anyone peeked at the produced machine code yet? How does it compare to e.g. VC2005 quality in this regard?
|
|||
19 Nov 2006, 12:11 |
|
OzzY 19 Nov 2006, 22:46
I'd like to see a comparison for code quality too.
Although as I've seen, all test programs I wrote are quite fast (looks faster than GCC). Even when using Garbage Collector it runs fast (I think the GC is manually invoked). A comparion for language features can be found here: http://www.digitalmars.com/d/comparison.html One thing I really like are the automatic sized arrays. I've never got a segfault since I started using D. Also unittest together with assert helps finding errors even before running the code for the "real thing". |
|||
19 Nov 2006, 22:46 |
|
vid 27 Mar 2007, 14:55
i browsed few articles on D site... looks like good replacement for Java or C#, with fixing some C++ design problems.
Anyway, i wouldn't see it as alternative for C. If I understood those texts right, all arrays are always dynamic, and that means D arrays are somewhat slower than C static arrays. It practically enforces very dynamic programming style. |
|||
27 Mar 2007, 14:55 |
|
OzzY 27 Mar 2007, 15:55
vid: I don't see D as an alternative for C, but for C++, C# and Java.
You still have the OOP and other (lots of) features, but with native compilation. You can still see D more or less as a native compiled C#. But I see D as a "compiled scripting language". It's really easy as scripting, and powerful as C++. You can even run the code without compiling, like a real scripting language! Plus, digital mars compilers are the fastest I've seen. You can do things like: Code: PhoneNumberOf[ "John" ] = 24234353252; AddressOf[ "John" ] = "Street 123..."; SexOf[ "John" ] = "Male"; And you can keep adding, sorting, and manipulating these arrays very easily. Like if I want to add another person I just do: Code: PhoneNumbeOf[ "Peter" ] = 3443434434; and so on... D manages the arrays for me. You gain in development speed and source beauty and don't lose too much compared to C++, and it's also faster than if you used Python for example, which is interpreted. OK. You can do these arrays manipulations in C++. But you have to use STL, and D have it in the core language. Give it a try! I don't use C++ anymore (only if I'm forced to, in a company for example). Quote:
Wrong. This is a static array: Code: int x[3]; And this is a dynamic array: Code: int x[]; See: http://www.digitalmars.com/d/arrays.html |
|||
27 Mar 2007, 15:55 |
|
vid 27 Mar 2007, 16:08
Quote: You can do things like: PhoneNumberOf[ "John" ] = 24234353252; What does resulting code looks like? How exactly does this work? O(N), or O(1)? Quote: This is is static array: int x[3]; hmm... can you demonstrate how to allocate static array of N bytes, store some string there, do several operations on it without any allocation needed? I got feeling that entire array and string handling of D is dynamic. |
|||
27 Mar 2007, 16:08 |
|
LocoDelAssembly 27 Mar 2007, 16:20
Quote:
http://www.digitalmars.com/d/arrays.html#associative It's hashed. This kind of data structure is also known as Dictionary (at least that is the class in SmallTalk ) |
|||
27 Mar 2007, 16:20 |
|
OzzY 27 Mar 2007, 16:20
vid: You still have full compatibility with C arrays and strings, because D have pointers too, and has some support to standard C library. You can use printf for example. You could do this like you already do in C. You can still use malloc if you want.
But D was created to be easier and solve some problems from other modern languages. It's just easier to use it with the dynamic way. There's no point in not using them if you are using D. If you don't like dynamic things or OOP it's really better to use C. But if you use C++ or Java a lot, D is perfect. You can copy arrays with pieces of memory directly: Code: x[0..10]=y[10..20]; // copy from 10th element of y to 20th to the first 10 elements of x; You don't even need a for to run through the piece of array to copy. You just need to take a look to the code generated to see how it goes. A benchmark would be nice in this point. |
|||
27 Mar 2007, 16:20 |
|
vid 27 Mar 2007, 16:31
i've missed link you provided, sorry. After reading more on it, yes, static arrays are provided. But i am still uncertain how to operate strings inside such array
|
|||
27 Mar 2007, 16:31 |
|
OzzY 27 Mar 2007, 16:36
An example:
Code: import std.stdio; void main() { int x[10]; int y[10]; int n=0; while(n<=9) // Filling array x { x[n] = n * 2; n++; } int len = x.length; // Get size of x y[0..len]=x[0..len]; // Copying array piece // Printing results writefln("Listing elements of x:"); foreach(i; x) writefln("%d",i); writefln("Listing elements of y:"); foreach(i; y) writefln("%d",i); } |
|||
27 Mar 2007, 16:36 |
|
vid 27 Mar 2007, 16:50
another question: how about interoperability with other languages? Does D compiler spit out usual object files (MS COFF, ELF)? How are names decorated? We could provide examples of mixing FASM and D with linking.
|
|||
27 Mar 2007, 16:50 |
|
OzzY 27 Mar 2007, 17:04
On Windows it uses OMF format. (The DMD compiler).
There is also GDC which uses GCC as backend. I never tried D on Linux. So I can't tell. D is object-compatible with C. Which means you can code a function in C and use in D or code in D and use it C. D is able to create DLL's, and also there are projects for multi-platform way of doing this. I'll research more and post some example. Also there is #D on freenode. The community is very helpful. For me a good community is very important. And both D and FASM have it. And here is a profiling of the example above on my ultra-slow machine: Quote:
I'll get some studying now. Later, when I get some time I'll post something for FASM usage together with D. |
|||
27 Mar 2007, 17:04 |
|
vid 27 Mar 2007, 17:54
Ozzy: you may need this: http://www.digitalmars.com/ctg/coff2omf.html
|
|||
27 Mar 2007, 17:54 |
|
OzzY 13 Apr 2007, 14:24
That coff2omf tool is not free.
I'm having trouble in find a free coff2omf tool. I only have tried the MS Linker that is able to convert OMF to COFF. But I need COFF2OMF so I create COFF in FASM, convert to OMF and link with DMD linker to the D library. When I find some tool to do it, I'll prepare some examples for FASM usage with D. Maybe using D dynamic arrays to manipulate easily data from ASM code. |
|||
13 Apr 2007, 14:24 |
|
Ehtyar 13 Apr 2007, 22:39
Borland's free command-line tools offer a "coff2omf" tool, but i haven't tested it myself. They can be found here but you'll need a login to download it (i'd post it here, but the tools are not redistributable).
Hope this helps, Ehtyar. |
|||
13 Apr 2007, 22:39 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.