digitalmars.D.announce - DMD 0.145 release
- Walter Bright (3/3) Jan 29 2006 Lots of bugs fixed. -fPIC code gen fixes, should be a big step towards
- John Reimer (5/11) Jan 29 2006 Nice update, Walter. Thanks again.
- Don Clugston (45/49) Jan 30 2006 And as a result of the template bug fixes, this is now possible:
- John Reimer (4/48) Jan 30 2006 Fascinating... I had to look at that for awhile to figure out what you
- James Dunne (11/64) Jan 31 2006 Yes, while that is fascinating it's still largely unreadable until you
- Dave (3/6) Jan 31 2006 All I can say is Wow!
- Hasan Aljudy (3/9) Jan 31 2006 Sorry for my ignorace .. but:
- John Reimer (6/16) Jan 31 2006 It's a flag critical to gcc for building shared libraries on Linux
- Carlos Santander (4/17) Feb 01 2006 Does it work? Can DMD really create .so files?
Lots of bugs fixed. -fPIC code gen fixes, should be a big step towards shared library support under Linux. http://www.digitalmars.com/d/changelog.html
Jan 29 2006
Walter Bright wrote:Lots of bugs fixed. -fPIC code gen fixes, should be a big step towards shared library support under Linux. http://www.digitalmars.com/d/changelog.htmlNice update, Walter. Thanks again. I liked this particularly:Fixed several problems with -fPIC code generation:) -JJR
Jan 29 2006
Walter Bright wrote:Lots of bugs fixed. -fPIC code gen fixes, should be a big step towards shared library support under Linux. http://www.digitalmars.com/d/changelog.htmlAnd as a result of the template bug fixes, this is now possible: -------------------------------------- // Create a constant array of int or uint sized items // as a dchar[] string. n is the index of the last item. template makeLookup(alias entry, int n) { static if (n == -1) // start with an empty array... const dchar [] makeLookup = ""; else // ... and fill it up const dchar [] makeLookup = makeLookup!(entry, n-1) ~ cast(dchar)entry!(n); } // only needed to workaround a DMD 0.145 bug template LookupTable(alias entry, int n) { const LookupTable = cast(typeof(entry!(0)) [])makeLookup!(entry, n); } // USAGE: Let's make a factorial lookup table template factorial(uint n) { static if (n<2) const uint factorial = 1; else const factorial = n * factorial!(n-1); } // Make an array of all the factorials from 0 to 13 (14!> uint.max) const smallfactorials = LookupTable!(factorial, 13); import std.stdio; void main() { for (int i=0; i<smallfactorials.length; ++i) writefln(i, " ", smallfactorials[i]); } -------------------------------------- I've wanted to do this in C++ for a very long time. I thought that we would need array literals to be able to do this. Apparently not. Also note the extensive use of type inference! If there was some way at compile time of doing a reinterpret_cast() from any type to an array of bytes, the LookupTable function could be made to work for ANY type whatsoever, with negligible increase in complexity. (just need to change cast(dchar) to something like reinterpret_cast(char[])). But, I even wonder if could be made to work without any casts at all. I can see that array literals are difficult in the general case. But here, all of the types are known. Would it be possible to do constant folding on arbitrary arrays, even before array literals are implemented?
Jan 30 2006
Don Clugston wrote:Walter Bright wrote:Fascinating... I had to look at that for awhile to figure out what you were up to! -JJRLots of bugs fixed. -fPIC code gen fixes, should be a big step towards shared library support under Linux. http://www.digitalmars.com/d/changelog.htmlAnd as a result of the template bug fixes, this is now possible: -------------------------------------- // Create a constant array of int or uint sized items // as a dchar[] string. n is the index of the last item. template makeLookup(alias entry, int n) { static if (n == -1) // start with an empty array... const dchar [] makeLookup = ""; else // ... and fill it up const dchar [] makeLookup = makeLookup!(entry, n-1) ~ cast(dchar)entry!(n); } // only needed to workaround a DMD 0.145 bug template LookupTable(alias entry, int n) { const LookupTable = cast(typeof(entry!(0)) [])makeLookup!(entry, n); } // USAGE: Let's make a factorial lookup table template factorial(uint n) { static if (n<2) const uint factorial = 1; else const factorial = n * factorial!(n-1); } // Make an array of all the factorials from 0 to 13 (14!> uint.max) const smallfactorials = LookupTable!(factorial, 13); import std.stdio; void main() { for (int i=0; i<smallfactorials.length; ++i) writefln(i, " ", smallfactorials[i]); }
Jan 30 2006
John Reimer wrote:Don Clugston wrote:Yes, while that is fascinating it's still largely unreadable until you grok the exploitation of dchars and strings! Wow... -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/MU/S d-pu s:+ a-->? C++++$ UL+++ P--- L+++ !E W-- N++ o? K? w--- O M-- V? PS PE Y+ PGP- t+ 5 X+ !R tv-->!tv b- DI++(+) D++ G e++>e h>--->++ r+++ y+++ ------END GEEK CODE BLOCK------ James DunneWalter Bright wrote:Fascinating... I had to look at that for awhile to figure out what you were up to! -JJRLots of bugs fixed. -fPIC code gen fixes, should be a big step towards shared library support under Linux. http://www.digitalmars.com/d/changelog.htmlAnd as a result of the template bug fixes, this is now possible: -------------------------------------- // Create a constant array of int or uint sized items // as a dchar[] string. n is the index of the last item. template makeLookup(alias entry, int n) { static if (n == -1) // start with an empty array... const dchar [] makeLookup = ""; else // ... and fill it up const dchar [] makeLookup = makeLookup!(entry, n-1) ~ cast(dchar)entry!(n); } // only needed to workaround a DMD 0.145 bug template LookupTable(alias entry, int n) { const LookupTable = cast(typeof(entry!(0)) [])makeLookup!(entry, n); } // USAGE: Let's make a factorial lookup table template factorial(uint n) { static if (n<2) const uint factorial = 1; else const factorial = n * factorial!(n-1); } // Make an array of all the factorials from 0 to 13 (14!> uint.max) const smallfactorials = LookupTable!(factorial, 13); import std.stdio; void main() { for (int i=0; i<smallfactorials.length; ++i) writefln(i, " ", smallfactorials[i]); }
Jan 31 2006
In article <drk0de$1f4j$1 digitaldaemon.com>, Walter Bright says...Lots of bugs fixed. -fPIC code gen fixes, should be a big step towards shared library support under Linux. http://www.digitalmars.com/d/changelog.htmlAll I can say is Wow! - Dave
Jan 31 2006
Walter Bright wrote:Lots of bugs fixed. -fPIC code gen fixes, should be a big step towards shared library support under Linux. http://www.digitalmars.com/d/changelog.htmlSorry for my ignorace .. but: What's -fPIC? What does it do?
Jan 31 2006
Hasan Aljudy wrote:Walter Bright wrote:It's a flag critical to gcc for building shared libraries on Linux (lib*.so). It stands for "Position Independent Code." With this flag, in theory, DMD finally supports Linux shared libraries. -JJRLots of bugs fixed. -fPIC code gen fixes, should be a big step towards shared library support under Linux. http://www.digitalmars.com/d/changelog.htmlSorry for my ignorace .. but: What's -fPIC? What does it do?
Jan 31 2006
John Reimer escribió:Hasan Aljudy wrote:Does it work? Can DMD really create .so files? -- Carlos Santander BernalSorry for my ignorace .. but: What's -fPIC? What does it do?It's a flag critical to gcc for building shared libraries on Linux (lib*.so). It stands for "Position Independent Code." With this flag, in theory, DMD finally supports Linux shared libraries. -JJR
Feb 01 2006