www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - DasBetterC: Converting make.c to D

reply Mike Parker <aldacron gmail.com> writes:
Walter's latest post on -betterC is now on the blog. Here, he 
shows step-by-step an example of using -betterC to convert a 
real-world program, one small enough to describe in a blog post, 
from C to D.

The blog:
https://dlang.org/blog/2018/06/11/dasbetterc-converting-make-c-to-d/

Reddit:
https://www.reddit.com/r/programming/comments/8q9u5t/dasbetterc_converting_makec_to_d/
Jun 11 2018
next sibling parent reply Andrea Fontana <nospam example.com> writes:
On Monday, 11 June 2018 at 14:21:20 UTC, Mike Parker wrote:
 Walter's latest post on -betterC is now on the blog. Here, he 
 shows step-by-step an example of using -betterC to convert a 
 real-world program, one small enough to describe in a blog 
 post, from C to D.

 The blog:
 https://dlang.org/blog/2018/06/11/dasbetterc-converting-make-c-to-d/

 Reddit:
 https://www.reddit.com/r/programming/comments/8q9u5t/dasbetterc_converting_makec_to_d/
Link to "completed conversion" doesn't work. https://github.com/DigitalMars/Compiler/blob/master/dm/src/make/make.c Andrea
Jun 11 2018
parent Mike Parker <aldacron gmail.com> writes:
On Monday, 11 June 2018 at 14:33:00 UTC, Andrea Fontana wrote:

 Link to "completed conversion" doesn't work.
 https://github.com/DigitalMars/Compiler/blob/master/dm/src/make/make.c

 Andrea
Fixed. Thanks!
Jun 11 2018
prev sibling next sibling parent reply Andrea Fontana <nospam example.com> writes:
On Monday, 11 June 2018 at 14:21:20 UTC, Mike Parker wrote:
 Walter's latest post on -betterC is now on the blog. Here, he 
 shows step-by-step an example of using -betterC to convert a 
 real-world program, one small enough to describe in a blog 
 post, from C to D.

 The blog:
 https://dlang.org/blog/2018/06/11/dasbetterc-converting-make-c-to-d/

 Reddit:
 https://www.reddit.com/r/programming/comments/8q9u5t/dasbetterc_converting_makec_to_d/
It seems that blog page is returned correctly by server but status is 404. Andrea
Jun 11 2018
parent bauss <jj_1337 live.dk> writes:
On Monday, 11 June 2018 at 14:52:13 UTC, Andrea Fontana wrote:
 On Monday, 11 June 2018 at 14:21:20 UTC, Mike Parker wrote:
 Walter's latest post on -betterC is now on the blog. Here, he 
 shows step-by-step an example of using -betterC to convert a 
 real-world program, one small enough to describe in a blog 
 post, from C to D.

 The blog:
 https://dlang.org/blog/2018/06/11/dasbetterc-converting-make-c-to-d/

 Reddit:
 https://www.reddit.com/r/programming/comments/8q9u5t/dasbetterc_converting_makec_to_d/
It seems that blog page is returned correctly by server but status is 404. Andrea
I noticed that too
Jun 11 2018
prev sibling next sibling parent reply Steven Schveighoffer <schveiguy yahoo.com> writes:
On 6/11/18 10:21 AM, Mike Parker wrote:
 Walter's latest post on -betterC is now on the blog. Here, he shows 
 step-by-step an example of using -betterC to convert a real-world 
 program, one small enough to describe in a blog post, from C to D.
 
 The blog:
 https://dlang.org/blog/2018/06/11/dasbetterc-converting-make-c-to-d/
 
 Reddit:
 https://www.reddit.com/r/programming/comments/8q9u5t/dasbetterc_co
verting_makec_to_d/ 
 
"static if can replace cmany uses of #if" cmany => many -Steve
Jun 11 2018
parent reply rikki cattermole <rikki cattermole.co.nz> writes:
On 12/06/2018 2:57 AM, Steven Schveighoffer wrote:
 On 6/11/18 10:21 AM, Mike Parker wrote:
 Walter's latest post on -betterC is now on the blog. Here, he shows 
 step-by-step an example of using -betterC to convert a real-world 
 program, one small enough to describe in a blog post, from C to D.

 The blog:
 https://dlang.org/blog/2018/06/11/dasbetterc-converting-make-c-to-d/

 Reddit:
 https://www.reddit.com/r/programming/comments/8q9u5t/dasbetterc_co
verting_makec_to_d/ 
"static if can replace cmany uses of #if" cmany => many -Steve
"(See the dcoumentation" "make manual pagewhen"
Jun 11 2018
parent Bastiaan Veelo <Bastiaan Veelo.net> writes:
On Monday, 11 June 2018 at 15:44:47 UTC, rikki cattermole wrote:
 On 12/06/2018 2:57 AM, Steven Schveighoffer wrote:
 On 6/11/18 10:21 AM, Mike Parker wrote:
 Walter's latest post on -betterC is now on the blog. Here, he 
 shows step-by-step an example of using -betterC to convert a 
 real-world program, one small enough to describe in a blog 
 post, from C to D.

 The blog:
 https://dlang.org/blog/2018/06/11/dasbetterc-converting-make-c-to-d/

 Reddit:
 https://www.reddit.com/r/programming/comments/8q9u5t/dasbetterc_converting_makec_to_d/
"static if can replace cmany uses of #if" cmany => many -Steve
"(See the dcoumentation" "make manual pagewhen"
"The #include files are replaced" <tt> font includes too many words. Nice read, I see translating to D is trending.
Jun 11 2018
prev sibling next sibling parent reply Walter Bright <newshound2 digitalmars.com> writes:
On 6/11/2018 7:21 AM, Mike Parker wrote:
 Walter's latest post on -betterC is now on the blog. Here, he shows
step-by-step 
 an example of using -betterC to convert a real-world program, one small enough 
 to describe in a blog post, from C to D.
 
 The blog:
 https://dlang.org/blog/2018/06/11/dasbetterc-converting-make-c-to-d/
 
 Reddit:
 https://www.reddit.com/r/programming/comments/8q9u5t/dasbetterc_co
verting_makec_to_d/ 
 
It's on the second page of Hacker News too. https://news.ycombinator.com
Jun 11 2018
parent reply Walter Bright <newshound2 digitalmars.com> writes:
Direct link:

https://news.ycombinator.com/item?id=17284350\
Jun 12 2018
parent reply biocyberman <biocyberman gmail.com> writes:
On Tuesday, 12 June 2018 at 08:42:51 UTC, Walter Bright wrote:
 Direct link:

 https://news.ycombinator.com/item?id=17284350\
I tried compiling 'make' for fun, but failed. Is the source on github outdated? You can see the errors here: https://github.com/DigitalMars/Compiler/issues/5
Jun 12 2018
parent Walter Bright <newshound2 digitalmars.com> writes:
On 6/12/2018 3:35 AM, biocyberman wrote:
 On Tuesday, 12 June 2018 at 08:42:51 UTC, Walter Bright wrote:
 Direct link:

 https://news.ycombinator.com/item?id=17284350\
I tried compiling 'make' for fun, but failed. Is the source on github outdated? You can see the errors here: https://github.com/DigitalMars/Compiler/issues/5
See followup there.
Jun 12 2018
prev sibling next sibling parent Kagamin <spam here.lot> writes:
What I had with actually modern C:
1) narrowing conversions
2) not only arrays decay to pointers, C happily allows the 
opposite too, eww
3) looks like C code loves to have function arguments named `in` 
and `out`

Also difficulties with transpiling to C don't look that big: 
errno is the first glaring example TLS usage in C, glibc even 
tunes TLS model for it; AFAIK, C++ stores current exception in 
some sort of static storage and provides a function to retrieve 
it from there, a similar approach can be used for C target, 
though betterc shouldn't use exceptions.
Jun 12 2018
prev sibling parent Joakim <dlang joakim.fea.st> writes:
On Monday, 11 June 2018 at 14:21:20 UTC, Mike Parker wrote:
 Walter's latest post on -betterC is now on the blog. Here, he 
 shows step-by-step an example of using -betterC to convert a 
 real-world program, one small enough to describe in a blog 
 post, from C to D.

 The blog:
 https://dlang.org/blog/2018/06/11/dasbetterc-converting-make-c-to-d/

 Reddit:
 https://www.reddit.com/r/programming/comments/8q9u5t/dasbetterc_converting_makec_to_d/
The example for replacing grouping together multiple pointer declarations has some raw HTML leaked into it, at least for me in Chrome.
Jun 12 2018