i've got a question... i want to make a REAL small scripting language by using a void * vector. i would like to know if this code is safe (causing memory leaks maybe?) and if there is any disadvantage for creating variables on the heap only.
also, i would like to know what you think about it.
here is my code:
Code:
vector<void *> pointers;
cout<<"Enter a type and a name"<<endl;
cout<<"Example: int a, string d"<<endl;
cin.getline(var,100);
vars=var;
for(int l=0;l<vars.length();l++){
if(vars.substr(l,1)==" "){
pos=l;
}
}
if(type=="int"){
pointers.push_back(new int);
cout<<"Value:";cout.flush();
cin>>(*((int*)pointers[i]));
cout<<*((int*)pointers[i])<<endl;
i++;
}
anyways, thanks for any replay