From sahil.kang at asilaycomputing.com  Mon May 22 10:25:51 2017
From: sahil.kang at asilaycomputing.com (Sahil Kang)
Date: Mon, 22 May 2017 01:25:51 -0700
Subject: [Rd] [PATCH] Ensure correct order of evaluation in macro
Message-ID: <fc0f3809-6832-92a8-607b-e9f845ebdcd8@asilaycomputing.com>

Hello,

I'd like to contribute this small patch (attached) that I think will 
help prevent some future bugs from occurring in paste.c.
By wrapping the macro's arguments in parentheses, we can ensure that the 
correct order of evaluation will take place during preprocessing.

To illustrate, we can use the == operator which has lower evaluation 
precedence than the < operator:
     * With the current macro, imax2(3==4, 1) expands to 0.
     * After applying this patch, imax2(3==4, 1) expands to 1 as expected.

Since I'm still relatively new to the mailing list, I've kept this patch 
small.
I did notice other macros that have this same issue, so I can start 
sending additional patches if this seems okay.

Thanks,
Sahil
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-patch
Size: 363 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-devel/attachments/20170522/0fd87568/attachment.bin>


[Rd] [PATCH] Ensure correct order of evaluation in macro
Sahil Kang