strings strangle sac
Bugzilla Link | 210 |
Created on | Mar 07, 2006 20:54 |
Resolution | FIXED |
Resolved on | May 11, 2006 16:10 |
Version | 1.00beta |
OS | Linux |
Architecture | PC |
Attachments | xUTQuadFI.sac, UTQuadFI.sac |
Extended Description
1. The attached kills sac2c w/-O3 and -noOPT. 2..The QUADfi function shows what I think is a good example of why the semantics of strtod are wrong: I start out with a character vector that I want to convert to a numeric vector. This requires repeated calls to strtod until the string is exhausted. Meanwhile... - I either have to do repeated catenations into the result, as each result element is built, or - Count the number of transitions from white space to non-white-space to compute final result size. - The fact that strtod returns a string means that the termination test is 0 != strlen(string). If this is like C, it means that the dumb thing has to iterate over the string looking for the NULL. This is really really expensive, when you do it N times. This whole class of functions should really work this way: - define their behavior so that they're based on character vectors (or matrices where that's appropriate - not sure I can think of one offhand), rather tha strings - Instead of returning a shorter string (as in strtod), return an offset into the argument where scanning stopped. Thus, the termination condition becomes: strtodres == shape(strtodarg)[0].