Hi Frank, thanks for your report. It seems the only (cheap) way of storing arbitrary symbols is to escape them with " ". I've done so now - will be mirrored to the SF cvs shortly.
best greetings, Thomas
Frank Barknecht schrieb:
Hallo, Frank Barknecht hat gesagt: // Frank Barknecht wrote:
attached is an example of a possible bug in the way, [pool] saves symbols starting with a number. This seems to be a new bug, as it was working in previous versions of pool, but is not in current CVS pool.
The correct data is stored, but loading seems to go wrong.
Hm, I found, where it goes wrong:
In pool.cpp, method: "static char *ReadAtom(char *c,A *a)" there is a check if a key is a float, which also detects strings like "10x20" as floats:
// ... // save character and set delimiter
float fres; // first try float if(sscanf(tmp,"%f",&fres) == 1) { if(a) { int ires = (int)fres; // try a cast if(fres == ires) flext::SetInt(*a,ires); else flext::SetFloat(*a,fres); } } // no, it's a symbol else { if(a) flext::SetString(*a,tmp); } // ...
"sscanf(tmp,"%f",&fres)" returns "1" for all strings which *start* with a digit, even if they later include alphabetic characters.
Now, does anyone know, how to better check for real floats?
Ciao