When I modify the program provided by the official website, there are the following questions, what is the reason?I just added something in the while (1) loop, and I got the following question。If you can give me some inspiration, I would be greatly appreciated.
A programming problem
-
- XCore Addict
- Posts: 169
- Joined: Fri Oct 23, 2015 10:23 am
Combinable functions have a strict format (initialisation + while(1){select{select-cases}}).
This is to make combining several of them together straight forward to the user and the compiler - no surprises, no confusion, no problems.
Effectively, all the initialisations will be pasted together and then all the select-cases will be pasted into one big while(1){select{}} block.
You could do this yourself, but having the compiler combining all the different bits onto a single logical-core is probably easier and more flexible.
It is a bit too restrictive (can't use unsafe{} blocks) and future versions of the compiler will hopefully relax some of the strictness.
This is to make combining several of them together straight forward to the user and the compiler - no surprises, no confusion, no problems.
Effectively, all the initialisations will be pasted together and then all the select-cases will be pasted into one big while(1){select{}} block.
You could do this yourself, but having the compiler combining all the different bits onto a single logical-core is probably easier and more flexible.
It is a bit too restrictive (can't use unsafe{} blocks) and future versions of the compiler will hopefully relax some of the strictness.
After your detailed explanation, I have a deeper understanding of this grammar, thank you very much.robertxmos wrote:Combinable functions have a strict format (initialisation + while(1){select{select-cases}}).
This is to make combining several of them together straight forward to the user and the compiler - no surprises, no confusion, no problems.
Effectively, all the initialisations will be pasted together and then all the select-cases will be pasted into one big while(1){select{}} block.
You could do this yourself, but having the compiler combining all the different bits onto a single logical-core is probably easier and more flexible.
It is a bit too restrictive (can't use unsafe{} blocks) and future versions of the compiler will hopefully relax some of the strictness.