|
|
|
|
|
by ncmncm
1631 days ago
|
|
I got as far into the tutorial as "Ada++ requires variable declarations to be made in a specific area called the declarative part", said "that's stupid" (actually out loud), and abandoned it. Then wrote this. (You're welcome.) Even C ditched its separate section for variable declarations. |
|
I'm not super familiar with Ada++, but in Ada all declaration areas are the same. You can declare anything (types, functions, variables, tasks i.e. threads, or even full packages) in any declaration area. This is actually somewhat powerful in being able to write everything locally and then refactor it out to where it belongs.
Writing tasks in declarations is interesting because they operate like C++ jthreads, so the related block of statements won't exit until all threads complete. You can get around this by detaching work by using allocators, but that's more advanced.