BetterC unexpected results

ryuukk_ ryuukk.dev at gmail.com
Sun Jan 8 23:59:21 UTC 2023


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: Failure at compilation stage, owing to 
> presence of dynamic array A, when -betterC set.
> Actual result: Ran to completion, dislaying the message.
>
> 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 array A, when -betterC set.
> Actual result: Failed at link (not compilation) stage.

That example is working for me

What's the exact code you wrote?


More information about the Digitalmars-d-learn mailing list