Re: BetterC unexpected results

2023-01-11 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
Makes sense, you wrote a main function which only applies to having a druntime. For -betterC, use the libc's main function: ```d extern(C) void main() { } ```

Re: BetterC unexpected results

2023-01-11 Thread DLearner via Digitalmars-d-learn
On Sunday, 8 January 2023 at 23:59:21 UTC, ryuukk_ wrote: [...] Example_03: ``` void main() { import core.stdc.stdio : printf; int[] A; printf("Hello betterC\n"); } ``` ``` dmd -betterC -run Example_03 ``` Expected result: Failure at compilation stage, owing to presence of dynamic arr

Re: BetterC unexpected results

2023-01-08 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 8 January 2023 at 13:49:22 UTC, DLearner wrote: I thought dynamic arrays were unavailable under -betterC. Example_02: ``` extern(C) void main() { import core.stdc.stdio : printf; int[] A; printf("Hello betterC\n"); } ``` ``` dmd -betterC -run Example_02 ``` Expected result:

Re: BetterC unexpected results

2023-01-08 Thread areYouSureAboutThat via Digitalmars-d-learn
On Sunday, 8 January 2023 at 13:49:22 UTC, DLearner wrote: I thought dynamic arrays were unavailable under -betterC. .. ... See the 'Retained Features' section, and the 'Unavailable Features' section https://dlang.org/spec/betterc.html

Re: BetterC unexpected results

2023-01-08 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
Dynamic arrays are not. Slices are. A slice is a pointer + length pair; it requires no runtime infrastructure to manipulate. A dynamic array, has slices that reference internal state in the GC which is where all the manipulation takes place (like appending).

BetterC unexpected results

2023-01-08 Thread DLearner via Digitalmars-d-learn
I thought dynamic arrays were unavailable under -betterC. Example_02: ``` extern(C) void main() { import core.stdc.stdio : printf; int[] A; printf("Hello betterC\n"); } ``` ``` dmd -betterC -run Example_02 ``` Expected result: Failure at compilation stage, owing to presence of dynamic