I'm experienced embedded C developer and I've started 2 years ago an implementation of one of the specifications kind of popular in the
payment industry. I also hope to make it open source one day.
have to guarantee consistency of a huge configurable data structure,
that can be changed by an entity which in theory may not be in my
control. And adding all checks quickly became nightmarish and then I've
found an Ada language.
I also have some concrete question, how to properly implement optional element? Right now I have something like this:
generic
type T is private;
package TypeUtils is
type Optional(exists : Boolean) is
record
case exists is
when True => value : T;
when False => null;
end case;
end record;
end TypeUtils;
But it looks like it doesn't work, because it depends on the
discriminant `exists' but it is set once in .ads file and I can't modify
it in runtime.
Can you say what specification it is?
It sounds like you waht to define a datatype for this structure, with
access and update procedures (OOP is not necessary but it's the same
idea) that make sure all the rules are followed. Is there more to it
than that?
Ada sounds like a reasonable choice, C sounds terrible, other
possibilities depend on the hardware and software environment. Would
this have to run on a smart card cpu or anything like that?
Aleksy Grabowski <hurufu@gmail.com> writes:
I'm experienced embedded C developer and I've started 2 years ago an
implementation of one of the specifications kind of popular in the
payment industry. I also hope to make it open source one day.
Can you say what specification it is?
have to guarantee consistency of a huge configurable data structure,
that can be changed by an entity which in theory may not be in my
control. And adding all checks quickly became nightmarish and then I've
found an Ada language.
It sounds like you waht to define a datatype for this structure, with
access and update procedures (OOP is not necessary but it's the same
idea) that make sure all the rules are followed. Is there more to it
than that?
Ada sounds like a reasonable choice, C sounds terrible, other
possibilities depend on the hardware and software environment. Would
this have to run on a smart card cpu or anything like that?
You DO have to bring in a special proc to FREE memory allocated
on the heap however. Kinda weird - you'd think making and freeing
would naturally be implemented together. This "free()" is very
type-specific, multiple incarnation of the proc will be needed
if you have multiple kinds of records to free.
On Fri, 14 Jan 2022 00:01:22 -0500, "1.AAC0832" <z24ba7.net> declaimed the following:
You DO have to bring in a special proc to FREE memory allocatedTake into account the origins for Ada. Many embedded/real-time applications follow the practice of pre-allocating all memory during application initialization before transitioning into "running" mode. They never deallocate memory. If something goes wrong, the entire application system is rebooted, resetting all memory.
on the heap however. Kinda weird - you'd think making and freeing
would naturally be implemented together. This "free()" is very
type-specific, multiple incarnation of the proc will be needed
if you have multiple kinds of records to free.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 405 |
Nodes: | 16 (2 / 14) |
Uptime: | 56:08:24 |
Calls: | 8,500 |
Calls today: | 1 |
Files: | 13,203 |
Messages: | 5,917,357 |