Thread overview |
---|
September 28, 2018 Funny way to crash dmd and brick the whole computer | ||||
---|---|---|---|---|
| ||||
CTE fib : module fib_cte; import std.stdio; long fib(long n) { if (n <= 1) return 1; return fib(n - 1) + fib(n - 2); } static immutable valueFib = fib(46); void main() { writeln(valueFib); } |
September 28, 2018 Re: Funny way to crash dmd and brick the whole computer | ||||
---|---|---|---|---|
| ||||
Posted in reply to Zardoz | On Friday, 28 September 2018 at 11:58:25 UTC, Zardoz wrote:
> CTE fib :
>
> module fib_cte;
> import std.stdio;
>
> long fib(long n) {
> if (n <= 1) return 1;
> return fib(n - 1) + fib(n - 2);
> }
>
> static immutable valueFib = fib(46);
>
> void main() {
> writeln(valueFib);
> }
to be fair, that function is incredibly inefficient.
when you write an iterative fibonacci-series generator, it'll work.
|
September 28, 2018 Re: Funny way to crash dmd and brick the whole computer | ||||
---|---|---|---|---|
| ||||
Posted in reply to Zardoz | On Friday, 28 September 2018 at 11:58:25 UTC, Zardoz wrote:
> CTE fib :
>
> module fib_cte;
> import std.stdio;
>
> long fib(long n) {
> if (n <= 1) return 1;
> return fib(n - 1) + fib(n - 2);
> }
>
> static immutable valueFib = fib(46);
>
> void main() {
> writeln(valueFib);
> }
This isn't a brick, this is your OS not handling lack of resources. A brick is when the machine will no longer boot without some physical intervention like JTAGing or replacing parts.
DMD sacrifices memory for speed so it is not surprising given that code abomination.
bye,
norm
|
September 29, 2018 Re: Funny way to crash dmd and brick the whole computer | ||||
---|---|---|---|---|
| ||||
Posted in reply to Zardoz | On Friday, 28 September 2018 at 11:58:25 UTC, Zardoz wrote:
> CTE fib :
>
> module fib_cte;
> import std.stdio;
>
> long fib(long n) {
> if (n <= 1) return 1;
> return fib(n - 1) + fib(n - 2);
> }
>
> static immutable valueFib = fib(46);
>
> void main() {
> writeln(valueFib);
> }
What exactly did you expect?
|
October 01, 2018 Re: Funny way to crash dmd and brick the whole computer | ||||
---|---|---|---|---|
| ||||
Posted in reply to Zardoz | On Friday, 28 September 2018 at 11:58:25 UTC, Zardoz wrote:
> CTE fib :
>
> module fib_cte;
> import std.stdio;
>
> long fib(long n) {
> if (n <= 1) return 1;
> return fib(n - 1) + fib(n - 2);
> }
>
> static immutable valueFib = fib(46);
>
> void main() {
> writeln(valueFib);
> }
don't try to compile this one linux:
```
void main(){ asm{ db cast(ubyte[]) "é"; } }
```
|
October 01, 2018 Re: Funny way to crash dmd and brick the whole computer | ||||
---|---|---|---|---|
| ||||
Posted in reply to Basile B. | On Monday, 1 October 2018 at 09:24:18 UTC, Basile B. wrote:
> On Friday, 28 September 2018 at 11:58:25 UTC, Zardoz wrote:
>> CTE fib :
>>
>> module fib_cte;
>> import std.stdio;
>>
>> long fib(long n) {
>> if (n <= 1) return 1;
>> return fib(n - 1) + fib(n - 2);
>> }
>>
>> static immutable valueFib = fib(46);
>>
>> void main() {
>> writeln(valueFib);
>> }
>
> don't try to compile this one linux:
>
> ```
> void main(){ asm{ db cast(ubyte[]) "é"; } }
> ```
Actually no, it's an IDE issue triggered by this code.
|
October 02, 2018 Re: Funny way to crash dmd and brick the whole computer | ||||
---|---|---|---|---|
| ||||
Posted in reply to Zardoz | On Friday, 28 September 2018 at 11:58:25 UTC, Zardoz wrote:
> CTE fib :
>
> module fib_cte;
> import std.stdio;
>
> long fib(long n) {
> if (n <= 1) return 1;
> return fib(n - 1) + fib(n - 2);
> }
>
> static immutable valueFib = fib(46);
>
> void main() {
> writeln(valueFib);
> }
I tried it on Android with LDC, it eventually just kills the process. You need to get a real OS. ;)
|
October 02, 2018 Re: Funny way to crash dmd and brick the whole computer | ||||
---|---|---|---|---|
| ||||
Posted in reply to Basile B. | On Monday, 1 October 2018 at 10:18:48 UTC, Basile B. wrote:
> On Monday, 1 October 2018 at 09:24:18 UTC, Basile B. wrote:
>> On Friday, 28 September 2018 at 11:58:25 UTC, Zardoz wrote:
>>> CTE fib :
>>>
>>> module fib_cte;
>>> import std.stdio;
>>>
>>> long fib(long n) {
>>> if (n <= 1) return 1;
>>> return fib(n - 1) + fib(n - 2);
>>> }
>>>
>>> static immutable valueFib = fib(46);
>>>
>>> void main() {
>>> writeln(valueFib);
>>> }
>>
>> don't try to compile this one linux:
>>
>> ```
>> void main(){ asm{ db cast(ubyte[]) "é"; } }
>> ```
>
> Actually no, it's an IDE issue triggered by this code.
In what world should an IDE ever have an issue with the code you write?
|
October 02, 2018 Re: Funny way to crash dmd and brick the whole computer | ||||
---|---|---|---|---|
| ||||
Posted in reply to bauss | On Tuesday, 2 October 2018 at 07:18:32 UTC, bauss wrote: >>> don't try to compile this one linux: >>> >>> ``` >>> void main(){ asm{ db cast(ubyte[]) "é"; } } >>> ``` >> >> Actually no, it's an IDE issue triggered by this code. > > In what world should an IDE ever have an issue with the code you write? It's a dparse bug : https://github.com/dlang-community/libdparse/issues/278. In the IDE when I execute the action "Compile module and run" several things happen which require to lex and parse the "runnable" module with dparse. 1. AST is visited to determine if "-main" have to be passed or not to the compiler: https://github.com/BBasile/Coedit/blob/master/dastworx/src/mainfun.d#L22 2. Imports are enumerated : https://github.com/BBasile/Coedit/blob/master/dastworx/src/imports.d#L23. The list is used to get their matching source path and static library file, which are passed to the compiler automatically (https://github.com/BBasile/Coedit/blob/master/src/ce_libman.pas#L125). <mode |= Mode.arrogant> Have you ever dreamed to have a system that solve dependencies without specifying them in a DUB embedded receipt or JSON/SDL ? I did it. <mode &= ~Mode.arrogant> |
Copyright © 1999-2021 by the D Language Foundation