i am studying some code and i notice something i never saw before.
There is a while loop but without the curly brackets.
I should explain what the code does, but this part with the while is confusing me.
I would appreciate it, if someone can explain me why the while loop dont have curly brackets.
#include <cstring>
#include <cerrno>
#include <algorithm>
#include <functional>
#include <iostream>
#include <memory>
#include <sys/random.h>
#include <sys/types.h>
#include <unistd.h>
using namespace std;
size_t n_children = 120; //size_t is an unsigned integer 0 .. 4,294,967,295
typedef int64_t Konto; // -9,223,372,036,854,775,808 .. 9,223,372,036,854,775,807, typedef abkürzung fü int64_t an Konto zugewiesen
Konto konto = 0; // 64 bits long long
int main() {
while (fork() && --n_children);
unsigned int transaktionen = 100; //
while (transaktionen--) { // 100 times
int8_t value; // 8 bit signed char (-128 .. 127)
if (getrandom(&value, sizeof(value), 0) == sizeof(value))
konto += value;
}
cout << "My Konto value: " << konto << endl;
return 0;
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…