Message-ID: <22278.15006.871215.53326@stat.math.ethz.ch>
Date: 2016-04-07T10:46:54Z
From: Martin Maechler
Subject: [PATCH] fix CHECK_this_length in sprintf.c
In-Reply-To: <CAApERuYP=0VZqzi-J3cB2zmZNwxhAyR_6GLacHs4zYbjzuzkKA@mail.gmail.com>
>>>>> Matthew Fowles Kulukundis <matt.fowles at gmail.com>
>>>>> on Tue, 5 Apr 2016 11:17:30 -0400 writes:
> All~
> CHECK_this_length macro expands to multiple statements making it unsafe to
> use in a single line `if` statement (as is happening near line 335). This
> fixes the macro using the standard `do { } while (0)` macro trick.
yes, but you forgot the closing '}' ... so you could not even
have compiled R after applying your patch.
Also, it would be nice to contrive a minimal example where the
change makes a difference. This "fails" to trigger :
--------------------------------
as.double.foo <- function(x) x[FALSE]
x <- structure(3, class="foo")
as.numeric(x) # numeric(0)
sprintf("%d !", x)# "3 !" instead of giving an error
--------------------------------
Thank you, Matt, in any case; this (with the "{" !) has now gone
into the source.
Martin
> Matt
> x[DELETED ATTACHMENT external: r-sprintf.patch, text/x-patch]
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel