[DTrace-devel] [PATCH 06/12] Assigning 0 to any dynamic variable should delete it

Kris Van Hees kris.van.hees at oracle.com
Mon Jan 8 23:54:12 UTC 2024


On Mon, Jan 08, 2024 at 04:50:44PM -0500, Eugene Loh via DTrace-devel wrote:
> On 1/8/24 15:45, Kris Van Hees wrote:
> 
> > On Mon, Jan 08, 2024 at 03:10:13PM -0500, Eugene Loh via DTrace-devel wrote:
> > > Reviewed-by: Eugene Loh <eugene.loh at oracle.com>
> > > 
> > > But my leading question is whether this changes the D programming language.
> > > E.g., I assume the associated scripts won't run with legacy DTrace?  At the
> > > very least, this change should be mentioned in the commit message.
> > I can do that.  It does not quite change the language to the extend that
> > assigning 0 to a dynamic variable is meant to delete the variable.
> > 
> > So, DTtrace was actually not implementing what the documentation describes.
> 
> Agreed.  I meant only the part that the parser didn't accept struct=int.
> 
> > But I will explain that in the commit message so it is clear.
> > 
> > > Related to that, I'm surprised this change doesn't break some test designed
> > > to catch "struct = int" errors.  (Or maybe not surprised if our test
> > > coverage was weak.  But then maybe this patch should introduce such a test,
> > > where "struct = 0" passes through.)
> > Well, this change only applies to dynamic variables, not to the general case
> > of struct = int or union = int.
> 
> Good point.  And even in the dvar case only to =0.  But  still... a quick
> look and I didn't see such a test.

Sure, but then again we do not have tests for most of the permutations of
assignments with LHS and RHS being of different type.  Feel free to add them,
though.  The only ones that might be a bit tricky is float and double, because
of the strange sttaus those types have.



More information about the DTrace-devel mailing list