lua-users home
lua-l archive

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



On 1-Sep-05, at 12:51 PM, Boyko Bantchev wrote:

On 9/1/05, Rici Lake <lua@ricilake.net> wrote:
None of those test cases has a "," unprotected by "("..")"

Is there a case where `,' is neither protected nor protectable
or trivially changeable to s.th. that does not need protection?

I think there are usually workarounds, but they can be ugly. Doing a {} block as a macro argument, whether or not it has the {} around it, is prone to errors:

// The one I mentioned before:
do ({ int i, j; ...

// Initializers:
do ({ struct npair i = {2, 3}; ...

// Templates:
do ({ Pair<int, double> i; ...

That last one is probably the hardest to get around. Of course, it only applies to c++.

This reference shows an interesting partial workaround within the Boost framework: http://www.kangaroologic.com/interfaces/libs/interfaces/doc/index.html? path=3.3.10

There was also some discussion about this on the FOREACH macro review earlier this year.