4 ms·
The author’s ZeroSharp project is also interesting. It shows how you can compile C# without any runtime. No garbage collection, no exceptions. You can perform s
by MarkSweep 5y ago
The author’s ZeroSharp project is also interesting. It shows how you can compile C# without any runtime. No garbage collection, no exceptions. You can perform stunts like make a 5KB Hello World or a EFI application that runs with no operating system:
https://github.com/MichalStrehovsky/zerosharp https://github.com/MichalStrehovsky/zerosharp
I did a survey recently of binary sizes for .NET apps and comparisons to other languages. Things like NativeAOT (on which Bflat is built) and Graal Native Image let these languages get down to a binary size , startup speed, and deployment model similar that enjoyed by Go and Rust developers.
https://github.com/AustinWise/SmallestDotnetHelloWorlds https://github.com/AustinWise/SmallestDotnetHelloWorlds
- throwaway894345 5y ago> You can perform stunts like make a 5KB Hello World Which, according to HN/proggit, is the only valid measure of a programming language. :)
- Gibbon1 5y agoIf one could cross compile to something like an ARM-Cortex, 5k hello world with no GC would be very interesting.
- hughrr 5y agoI’m not sure it would because a C one is measured in bytes and does the same thing.
- MarkSweep 5y agoI assume you mean an ARM microcontroller? I think it may be possible. .NET has a code generator for ARM32, which I think generates Thumb-2 instructions. The trouble I had last time I tried (.NET Core 3.1 I think) is you needed a cross compiling versio of RyuJIT that has the same bitness of your target. That is , you needed one that ran on linux x86 targeting linux arm32. And that was not easy to find. Maybe if I try compiling from a Arm32 host it will be easier.
- raoof 5y agoa little off topic. has anybody tried using C# as a nicer C ? I tried using D(betterC) a while ago but I hit some compiler bugs that was annoying. I also tried Zig but compilation times is not preferable. I don't want anything better than C I just want nicer C and without header files and compiler bugs.
- pjmlp 5y agoC# is a managed C++ (not to mix with the actuall one[1}), so why bother with C? D better C mode is getting better with each version actually, even if there are some corners to fix. [1] - https://en.wikipedia.org/wiki/Managed_Extensions_for_C%2B%2B https://en.wikipedia.org/wiki/Managed_Extensions_for_C%2B%2B
- raoof 5y agobecause it has all the pieces of the puzzle to turn into a C, like D that has a -betterC flag I hope that maybe they add something like that for C#. I also hope you keep working on D(betterC) but for now I stick with C, generating C using bb(clojure) is also an option.