
C2 language – now has library support and Windows support through Cygwin - magnusi
Hello, I know that C2, a C-like language by bvdberg, was shown here once before, but it was in much earlier stages of development. Now that one can use libraries it is possible to make &quot;real&quot; programs with it. Now in this stage, what is your quick opinion on C2, smart people of Hacker News?<p>https:&#x2F;&#x2F;github.com&#x2F;c2lang&#x2F;c2compiler
https:&#x2F;&#x2F;c2lang.org&#x2F;documentation
======
J_Darnley
The docs are not available at that URL. It looks like the https is a different
server. They seem to be here:
[http://c2lang.org/site/](http://c2lang.org/site/)

[edits...]

I'm glad it has explicit integer sizes. I use C99 standard types often. I
don't have much of an opinion on the explicit bool type although I hope it has
a defined size.

I'm surprised it allows fall-through in a switch statement. I thought people
hated C in that you needed a break keyword to prevent it.

It is interesting that its compiler is also the build system but I see that
being a problem if you need to mix languages. For example: I have a Lua script
I want to embed into my code. Doing this is simple with make and hard with
every other build system.

Windows/Cygwin support means I will look at building this.

~~~
magnusi
Yes, I really like explicit integer sizes too and yes. C2 is trying to be as
close to C as possible, with just improving what is "bad" or cumbersome, so
some things like the fall-through are still there. You can certainly mix
languages, since C2C (the compiler) allows single-file compilation, although a
bit cumbersome, with the -f parameter and currently, it works like this:

1\. Find (recursive searching upwards in directory tree) & Read a recipe file
(a file for the build system)

2\. Either start building all targets or just some, depending on the command-
line arguments

3\. Build the targets. Output is C (basically complete) or LLVM IR bytecode
(like 25% complete).

4\. Write a makefile for said C files

5\. Compile with default C compiler

so mixing languages works with a little hacking.

I am the author of the Windows/Cygwin support/port, so in case anything
doesn't work (especially since the compilation of LLVM is often a horror in
Cygwin), let me know and I will see what I can do.

------
gigatexal
Looks pretty cool - automatically growing arrays are neat.

~~~
magnusi
Yeah, I find that it is one of the best ideas C2 brings to the table

