T
T
The_frog2021-09-25 20:04:59
Pascal
The_frog, 2021-09-25 20:04:59

What is the difference between halt(0) and halt(1)?

614f5604c07d2055882999.png

Where specifically is halt or halt(0) used, and where is halt(1-255)?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vasily Bannikov, 2021-09-25
@vabka

halt(0) - if the program terminated without errors.
halt(not zero) - if with an error

O
OCTAGRAM, 2021-09-25
@OCTAGRAM

If run from bash: Then for Halt(0) echo True will work, and for Halt(1) echo False will work. You can also write in bash like this:
./MyProgram && echo True || echo False

set -e
./Generate_ORM ...
gprbuild ...
7z a ...
sftp ...
ssh ...

Here set -e sets the error intolerance mode. Each line break or semicolon works as two ampersands. In this chain, if something does not work normally, then the execution does not continue. If the sources are not generated, there is no point in compiling them, and if they are not compiled, then there is no point in packing the compiled one, and if it is not packed, then there is no point in uploading it to the server, and if it is not uploaded to the server, then there is no point in restarting the server remotely. As a rule, the program reports that it failed with the exit code of the process.

H
HemulGM, 2021-09-25
@HemulGM

It is not used anywhere. This will be used if you do this in your program. This works the same way as the result of the function

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question