Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2007-12-03
20:47 • Closed ticket [1836519fff]: Make two-arg switch safe and fast plus 7 other c... artifact: 20f1d7fe22 user: dkf
2007-11-22
22:21 • Ticket [1836519fff]: 4 changes artifact: 13e424b05d user: pspjuth
22:21 • Add attachment switch.patch to ticket [1836519fff] artifact: 5fada84ff5 user: pspjuth
15:21 • New ticket [1836519fff] Make two-arg switch safe and fast. artifact: 6dfb01141a user: pspjuth

Make two-arg switch safe and fast

Closed / Accepted1836519fffffffffffffffffffffffffffffffffCreated 19 years agoUpdated 19 years ago
Descriptionplain2007-11-22 15:21:07
When switch gets two arguments they cannot
legally be options, yet they are scanned
for options leading to that the simple way
of coding:
switch $a {
  xx yy
}
is not as safe as one would hope when $a
happens to begin with "-".

Not parsing for options where they cannot
legally be are common in Tcl commands, e.g.
lsort and lsearch does this.

This patch makes the most straightforward
switch usage also be the safest and fastest.
pspjuthplain2007-11-22 22:21:08
File Added - 255442: switch.patch
dkfplain2007-12-03 20:47:53
Logged In: YES 
user_id=79902
Originator: NO

Implemented, though in a slightly different way.
Log in (anonymous is fine) to add a comment.

Attachments: