HackerTrans
TopNewTrendsCommentsPastAskShowJobs

glacia01

no profile record

comments

glacia01
·hace 3 años·discuss
I'm not Android expert in any way, but VM have nothing to do with virtualization. I think you're confusing something.
glacia01
·hace 3 años·discuss
>That’s the idea behind the price cap on Russian oil

Except it doesn't work, like at all. China, India and others still buy russian oil way above the price cap.
glacia01
·hace 3 años·discuss
>See this fascinating article about Western CNCs used in the production of Iskander missiles

Pretty much all Russian factories run on US/Europe equipment. It's not really a secret, not sure what's surprising about that.

>Think also secondary sanctions, i.e. sanctions against countries and organizations that help circumvent sanctions. For example, companies in, say, China or Uzbekistan profiteer by selling to Russian companies components bought from the West. Let’s make them face a dilemma: if you do business with Russia or NK you will be cut off from the West.

You'll have to sanction dozen of countries then. It's not really practical.

If west really wants to deal a blow to Russia then they need to make oil super cheap somehow, that would stop Russia really fast. Unfortunately that will never happen too...
glacia01
·hace 3 años·discuss
>But the thing is, we're talking embedded here. Most ucontrollers I use have 8b address space, no MMU or any form of virtual memory, separated instruction/data bus (MVHA). That kind of thing don't play well with funky fat pointers.

You can definitely use Ada on 8bit microcontrollers, for example on 8bit AVR: https://docs.adacore.com/gnat_ugx-docs/html/gnat_ugx/gnat_ug...

You can make runtime as small as you want.

As for exceptions and threads: I mentioned them because thats what comes to mind first, there are more benefits obviously.
glacia01
·hace 3 años·discuss
Representation clause is just language defined way of how struct (Record in Ada) Enum or Array are actually laid out in memory. So, for example, you can define a struct that represents a register, overlay that register address and use it like this:

  procedure Enable_USB_Clock is
  begin
     Registers.PMC_Periph.PMC_SCER.USBCLK := 1;
  end Enable_USB_Clock;
Example taken from here: https://learn.adacore.com/courses/Ada_For_The_Embedded_C_Dev...
glacia01
·hace 3 años·discuss
>I know berating C is trendy, but it feels a bit gratuitous and uncalled for in your comment...

Sorry about that, English is not my first language so i might sound rude sometimes. I actually dont hate C, but if you used it you know its flaws. I think stuff i mentioned about C is objectively bad, hence why i called them dumb stuff.

>Not sure I would like fat pointers, exceptions and threads in my embedded code though

Fat pointers are just pointer + size of an object. You have to pass array size anyway, so its just convenient. Obviously, if you need to just pass a pointer there are ways to do that.

As for exceptions and threads: As i said, you can disable or modify them just by using Restrictions pragma. Its a language defined thing. For example, Ada 2022 defines two profiles for safety-critical hard real-time computing:

https://en.wikipedia.org/wiki/Ravenscar_profile http://www.ada-auth.org/standards/22rm/html/rm-d-13.html
glacia01
·hace 3 años·discuss
It does have Rust like borrowing in SPARK subset of the language.

There was attempt to have it in Ada 2022 Standard, but it came late. Committee decided it's best not to rush and let compiler vendors implement how they think is best and go from there.

>It’s safer than C, but I’m not quite sure where recent specs line up against C++.

Ada allows to return objects of variable size, so it's not that common that you actually need to explicitly allocate stuff. The general guideline for dynamic memory allocation is:

1) Use Second stack (this is how Ada allows to return object of variable size) 2) If cant use containers 3) If cant use controlled types (RAII) 4) Only then use New.
glacia01
·hace 3 años·discuss
>GNAT, the free software Ada implementation, uses the GCC backend so it is pretty good:

GNAT also has LLVM Backend: https://github.com/AdaCore/gnat-llvm It's stable and Adacore plans to ship it in GNAT Pro 24, i.e. next release. Note that it's the same front-end, so you get best of both worlds basically.
glacia01
·hace 3 años·discuss
There are a lot of aspects where Ada is better than C. Just a few things that came to mind:

General lack of dumb C stuff like switch fallthrough, null terminated strings (Arrays in Ada are passed with fat pointers), undefined behavior, no need for memcpy, no preprocessor bullshit etc.

Ada is more like C++ in functionality so it has Generics, Tasks (Threads), Exceptions, Packages, Strong types, Design by contract etc (All much much saner than C++ stuff)

Despite all of the features it's very embedded friendly. Language allows you to disable features you dont wont with Restrictions Pragma (Very long list of restrictions you can apply: https://docs.adacore.com/gnat_rm-docs/html/gnat_rm/gnat_rm/s...). You can also fairly easily change runtimes: https://docs.adacore.com/gnat_ugx-docs/html/gnat_ugx/gnat_ug....