Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Is allegro 4/5 compatible with the D language, especially -betterC

This thread is locked; no one can reply to it. rss feed Print
Is allegro 4/5 compatible with the D language, especially -betterC
larienna
Member #3,185
January 2003
avatar

I took a look recently at the D programming language to see what it has to offer compared to C. I know there are some compatibility between C and D libraries (D can use C, but not the opposite direction). There are very interesting code features that still make the language look and feel like C instead of that C++ atrocity. Here is a list of the differences between D and C:

https://dlang.org/articles/ctod.html

Another feature I learned at the same time is that D has a compile option named "-betterC" which basically does not include the D runtime but allows most of the syntax upgrade of the D language (Like foreach). You lose some features like assertions and the garbage collector. On the other hand, the binaries seems to retain their compatibility with other C libraries. Which would allow creating a C library using D syntax.

So my question is:

Did anybody tried using Allegro 4 and/or 5 with the full D language, or just the "-betterC" option?

Enjoy! and have fun

LennyLen
Member #5,313
December 2004
avatar

I haven't used D myself, but these pages should be useful to you:

DAllegro for A4
DAllegro for A5

torhu
Member #2,727
September 2002
avatar

larienna said:

Did anybody tried using Allegro 4 and/or 5 with the full D language, or just the "-betterC" option?

Yes, some of us have done that:
http://dsource.org/projects/dallegro
https://github.com/SiegeLord/DAllegro5

EDIT: I guess LennyLen beat me to it ;D I'm also active in the D forums/newsgroups, by the way.

larienna
Member #3,185
January 2003
avatar

I guess I'll try it out. I am on Linux, so I could try to run the tests and demo to see if it works.

I am more interested in the "-betterC" option in order to create compatible C libraries. Hope that works too.

I would like to have my "foreach" and a few other goodies.

Enjoy! and have fun

torhu
Member #2,727
September 2002
avatar

I think D is a nice language to program in, although tool and library support is not quite comparable to C++. But DUB and code.dlang.org are improvements to the situation, those didn't exist when I started using D 16 years ago.

I have never tried to use Better C, not sure what it would be to use D without dynamic arrays, classes, and exceptions. I suppose even basic utilities like std.conv.to wouldn't work then... :-/

larienna
Member #3,185
January 2003
avatar

In fact, I am more a fan of Plain C than C++. I don't use object oriented programming. So I don't need for example a garbage collector.

The D syntax looks much nicer, a lot of improvement I would like C to have are available in D.

So I am strongly considering porting the libs I am working on with the D syntax to be easier to develop and maintain.

Enjoy! and have fun

Go to: