Re: [Vala] [PATCH] Add parenthesis to macro substitutions



On Thu, 2009-06-25 at 18:51 +0200, Frederik Sdun wrote:
thats a common problem with C makros. Here a better example:

public const double AAAA = 1.0 + 3.0;
public const double BBBB = 2.0 / AAAA;

BBBB will be replaced to 2.0 / 1.0 + 3.0 = 5.0 instead of 0.5.
The Patch add () around AAAA and the statement will be correct:

BBBB = 2.0 / ( 1.0 + 3.0 ) = 0.5

Thanks, it certainly helps to look at all attachments before
responding...

I've pushed a slightly different patch to avoid unnecessary parenthesis.

Jürg




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