Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$switch not working on Windows build #2046

Closed
orangebowlerhat opened this issue Mar 14, 2025 · 6 comments
Closed

$switch not working on Windows build #2046

orangebowlerhat opened this issue Mar 14, 2025 · 6 comments
Labels
Additional info please Further information is requested

Comments

@orangebowlerhat
Copy link

Using the latest Windows binary, version 0.7.0, this comes from the compiler:

712:   $switch (OUTPUT)
 713:           $case 0:
                ^^^^^
(D:/Work/Intratech/obj.c3:713:3) Error: Expected ':'.

Clearly, it reports a missing ':' character although the character is in the code. OUTPUT is a const int defined earlier in the file. This same file compiles without error in linux and works as expected.

@lerno
Copy link
Collaborator

lerno commented Mar 15, 2025

You want: $switch OUTPUT:

@lerno lerno added the Additional info please Further information is requested label Mar 15, 2025
@orangebowlerhat
Copy link
Author

orangebowlerhat commented Mar 15, 2025

$switch OUTPUT: produces

712:   $switch OUTPUT:
                ^^^^^^
(/Storage/Work/Intratech/obj.c3:712:10) Error: A '$case' or '$default' would be needed here.```

as does $switch OUTPUT

Whereas $switch (OUTPUT) compiles and runs without error. This format also matches the documentation https://c3-lang.org/generic-programming/compiletime/

That's not the error anyway. The error is reported on the $case line.

@lerno
Copy link
Collaborator

lerno commented Mar 16, 2025

The documentation follows 0.6.8 syntax. You said you were using 0.7.0 prerelease.

This should compile fine in 0.7:

const OUTPUT = 1;
$switch OUTPUT:
$case 0:
  io::printn(2);
$endswitch

Can you send me a bigger part of code?

@orangebowlerhat
Copy link
Author

orangebowlerhat commented Mar 19, 2025 via email

@orangebowlerhat
Copy link
Author

That syntax does work on 0.7. My linux distro hasn't updated its version of c3c yet so the two are out of sync.

Are there other syntax changes? Are they documented somewhere? I ask because I'm getting a few other problems when compiling with 0.7.0 on Windows that don't occur with 0.6.7 on linux.

I there a way to get the older binary for Windows?

@orangebowlerhat
Copy link
Author

BTW, I did get c3c to cross compile from linux to windows, so my issue is solved and I'm happy to close this now. Thanks for your patience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Additional info please Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants