bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: unassigned/untyped behaviour


From: arnold
Subject: Re: unassigned/untyped behaviour
Date: Tue, 21 Nov 2023 12:38:56 -0700
User-agent: Heirloom mailx 12.5 7/5/10

arnold@skeeve.com wrote:

> Hi All.
> ....

Harumph. The diff I sent is wrong. Here is a diff that matches
the code in node.c and mfpr.c.

Arnold
------------------------------------------
diff --git a/awk.h b/awk.h
index cbc0a7e8..b12f1d90 100644
--- a/awk.h
+++ b/awk.h
@@ -2006,6 +2006,16 @@ unref(NODE *r)
 static inline NODE *
 force_number(NODE *n)
 {
+       if (n->type == Node_elem_new) {
+               n->type = Node_val;
+               n->flags &= ~STRING;
+               n->stptr[0] = '0';      // STRCUR is still set
+               n->stlen = 1;
+
+               assert((n->flags & NUMCUR) != 0);
+
+               return n;
+       }
        return (n->flags & NUMCUR) != 0 ? n : str2number(n);
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]