Low level programming in ada. Capture a signal,
https://gitlab.com/alaindevos/adatut/-/tree/main/11_signal/src?ref_type=heads
https://gitlab.com/alaindevos/adatut/-/tree/main/11_signal/src?ref_type=heads
Ada its quite easy:One simple example . In C you can dereference a null pointer & a pointer pointing to the sky. Never possible in F# or ada
with Ada.Text_IO;
procedure Erroneous is
type Int_Ptr is access Integer;
P : Int_Ptr; -- uninitialized
begin
-- ERRONEOUS EXECUTION
Ada.Text_IO.Put_Line (Integer'Image (P.all));
end Erroneous;
open Microsoft.FSharp.NativeInterop
#nowarn "9" // allow NativePtr usage
let demo () =
// Allocate stack memory for an int, but DO NOT initialize it
let p = NativePtr.stackalloc<int> 1
// ERRONEOUS / UNDEFINED BEHAVIOR
let x = NativePtr.read p
printfn "%d" x
demo ()
Ada its quite easy:
Code:with Ada.Text_IO; procedure Erroneous is type Int_Ptr is access Integer; P : Int_Ptr; -- uninitialized begin -- ERRONEOUS EXECUTION Ada.Text_IO.Put_Line (Integer'Image (P.all)); end Erroneous;
F# is just .NET so the typical bindings marshal errors allow it too.
Code:open Microsoft.FSharp.NativeInterop #nowarn "9" // allow NativePtr usage let demo () = // Allocate stack memory for an int, but DO NOT initialize it let p = NativePtr.stackalloc<int> 1 // ERRONEOUS / UNDEFINED BEHAVIOR let x = NativePtr.read p printfn "%d" x demo ()
And since languages other than C or C++ need a *shedload* of bindings, this kind of dangerous stuff is very easy (and necessary) to creep in.
String: type == std::string;
auto& Cout = std::cout;
#define Format std::format
greet: (name: String) = {
Cout << Format("Hello, {}\n", name);
}
sum: (a: i32, b: i32) -> i32 = {
sum := a + b; // Type inference with :=
return sum;
}
main: () = {
x: String = "world";
greet(x);
s:=sum(10, 20);
Cout << Format("Sum : {}\n", s);
}
I like it to an extent. I do think extensions of C (and C++) do have a lot of merit as a solution for a next gen language.What do you think of my cppfront program , hello.cpp2 ,
And you miss to name those things that you regard as important.... and miss the important things that need to be improved.
The limitations of C++ are well cited in a number of papers. I don't expect every technical conversation needs to be suitable for kids.And you miss to name those things that you regard as important.
Think about all these kids reading here ... do you think that they know??![]()
And this is where we wrap around to C being the lingua franca of programming. No matter what language you write in, if you want to talk to anything that isn't your language, you must speak some dialect of C.And since languages other than C or C++ need a *shedload* of bindings, this kind of dangerous stuff is very easy (and necessary) to creep in.
extern "C", and you'll need a C header for those exported symbols to be usable. There is tooling to generate both the Rust bindings and the C headers. Naturally you'll want to verify the output, and correct it where needed, but that gets most of the heavy lifting done.From The rustc dev guide, Updating LLVMRust supports building against multiple LLVM versions:
Tip-of-tree for the current LLVM development branch is usually supported within a few days. PRs for such fixes are tagged with llvm-main.
The latest released major version is always supported.
The one or two preceding major versions are usually supported.
See this long-standing PR 274743.No, Rust doesn't use upstream LLVM as default setting. It does, however, support upstream LLVM:
From The rustc dev guide, Updating LLVM
I read the link. If you suggest that it is important to be updated, it is a bad example. You can spend a lifetime studying only one fractal curve, a recent branch in topology, avoid this one.The limitations of C++ are well cited in a number of papers. I don't expect every technical conversation needs to be suitable for kids.
Similarly to before, I can only recommend people read around if they are struggling to keep up.