so i am taking my first c++ under unix class and i'm wondering what would happen if you ran this code:
from the way i understand it, the code would keep creating new processes that compile the bigapp.ccp with a new name each time. if the application took a considerable amount of time to compile wouldnt this program eventually crash the PC because it would be running so many times and trying to compile each time. essentially it would try to do this forever right? since the pid will never be 0 again. or am i wrong?
i would have run it on the server we do our programming on but i was scared >.>
#include <iostream>
#include <string>
using namespace std;
int main(){
string str;
int pid = fork();
int a=0;
while(pid!=0){
pid=fork();
str="g++ bigapp.ccp -o ";
char c=a;
str.insert(18,c);
system(str);
a++;
}
return 0;}
from the way i understand it, the code would keep creating new processes that compile the bigapp.ccp with a new name each time. if the application took a considerable amount of time to compile wouldnt this program eventually crash the PC because it would be running so many times and trying to compile each time. essentially it would try to do this forever right? since the pid will never be 0 again. or am i wrong?
i would have run it on the server we do our programming on but i was scared >.>