Re: LDC / BetterC / _d_run_main

2018-03-10 Thread Richard via Digitalmars-d-learn
On Saturday, 10 March 2018 at 10:57:05 UTC, Johan Engelen wrote: On Saturday, 10 March 2018 at 07:54:33 UTC, Mike Franklin wrote: On Saturday, 10 March 2018 at 02:25:38 UTC, Richard wrote: Hi, I've been trying to see if I can get an mbed project to work with Dlang basically compiling D code f

Re: LDC / BetterC / _d_run_main

2018-03-10 Thread Richard via Digitalmars-d-learn
On Saturday, 10 March 2018 at 07:54:33 UTC, Mike Franklin wrote: On Saturday, 10 March 2018 at 02:25:38 UTC, Richard wrote: Hi, I've been trying to see if I can get an mbed project to work with Dlang basically compiling D code for use on a Cortex-M Proccessor You might be interested in the f

LDC / BetterC / _d_run_main

2018-03-09 Thread Richard via Digitalmars-d-learn
Hi, I've been trying to see if I can get an mbed project to work with Dlang basically compiling D code for use on a Cortex-M Proccessor So far I've been using the latest release of LDC with the -BetterC Flag From what I can gather, normally without -BetterC it works like this: * main() - C

Re: question about conditional operator (?:)

2016-07-26 Thread Richard via Digitalmars-d-learn
On Tuesday, 26 July 2016 at 13:19:54 UTC, ag0aep6g wrote: Operator precedence is different from what you think. `a ? b : c = d` means `(a ? b : c) = d`. But you want `a ? b : (c = d)`. So you need parentheses around `p+=1`. Or just go with `if` and `else`. It's clearer anyway. From http://wi

question about conditional operator (?:)

2016-07-26 Thread Richard via Digitalmars-d-learn
Hello all, I've got a program that correctly computes the largest factor in the prime decomposition of a positive number: * import std.math std.stdio; ulong largestPrimeFactor(ulong n) { for(ulong p=2; p<=sqrt(cast(real)n); ) { i