Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2000-10-26
08:29 • Closed ticket [218793ffff]: use strtol_magic for optional Octal conversion p... artifact: e6dd7e44cd user: welch
01:05 • New ticket [218793ffff]. artifact: 73c27d860d user: nobody

use strtol_magic for optional Octal conversion

Closed / Fixed218793ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 01:05:25
OriginalBugID: 2145 RFE
Version: 8.1
SubmitDate: '1999-06-03'
LastModified: '1999-12-09'
Severity: MED
Status: Released
Submitter: techsupp
ChangedBy: hobbs
RelatedBugIDs: 1726
OS: AIX
Machine: RS6000
FixedDate: '1999-12-09'
FixedInVersion: 8.3b1
ClosedDate: '2000-10-25'


Name:
Phil Dietz

DesiredBehavior:
Many people would like to see Octal conversion be optional.
    Donal Fellows has posted a strtol_magic function on dejanews.com that
    does just that.
    
    Thanks.

PatchFiles:
long strtol_magic(const char *str, char **endptr, int base) {
          extern int noOctal;
          if (base!=0 || noOctal!=0 || (str[0]=='0' && str[1]=='x')) {
        return strtol(str, endptr, base);
          } else {
              return strtol(str, endptr, 10);
          }
      }



This is being seriously considered for 8.3.  It would be better
if it came as a drop-in patch to 8.2.0 that supported some sort
of tcl_useOctal var that maintained the old behavior by default. 
-- 08/20/1999 hobbs
Tcl 8.3 has greatly improved error messages for octals (if you
made an error because of a bad octal, you'll know it without
question).  The idea of a global switch to perterb behavior was
not generally popular, so we're going with the better error
messages, and may consider something else for Tcl9, when we
can be more lax on backwards compatibility. 
-- 12/09/1999 hobbs
welch Closed ticket [218793ffff]. [History diff]2000-10-26 08:29:15
Log in (anonymous is fine) to add a comment.