Browse Source

frontend/com_let.c, bug fix, "#302 Integer in Let Statement"

let 2foo = someexpression

was silently accepted, even though 2foo is an illegal identifier.
  (first letter is a digit)

This was especially irritating, since
  print 2foo
has a legal meaning, 2 femto oO, which is 2e-15
  (whatever Unit an oO might be)

Reported by Justin Fisher in
  http://sourceforge.net/p/ngspice/bugs/302/
pre-master-46
rlar 11 years ago
parent
commit
cab63eedd4
  1. 2
      src/frontend/com_let.c

2
src/frontend/com_let.c

@ -123,7 +123,7 @@ com_let(wordlist *wl)
*++q = '\0';
/* sanity check */
if (eq(p, "all") ||strchr(p, '@')) {
if (eq(p, "all") || strchr(p, '@') || isdigit(*p)) {
fprintf(cp_err, "Error: bad variable name %s\n", p);
tfree(p);
return;

Loading…
Cancel
Save