Hi All, I would like to return to the problem with stripping parenthesis in expression optimizer. In general Clipper optimizer does not reduce (<exp>) to <exp>. It means that during compilation it can reduce: x := 1 - -1 to: x := 2 eliminating RT overhead. But it cannot reduce: x := 1 - ( -1 ) In some cases it's a serious problem because not only RT overhead is important. Only fully optimized expression can be used to initialize static variables. F.e.: static s := 1 - -1 is legal expression in Clipper but: static s := 1 - (-1) isn't. People using lot of macros very often have to use parenthesis to force operator precedence. F.e. this code:
#define DEC(x) x-1 ? DEC(5) * 3 gives differnet result then: #define DEC(x) (x-1) ? DEC(5) * 3 So in many situation it's a must to use parenthesis. Now with some exceptions (f.e. Harbour can compile code like: #define DEC(x) (x-1) static s := DEC(5) * 3 and Clipper cannot) we are Clipper compatible. I would like to introduce full parenthesise stripping in expression optimizer so parenthesis will not block optimization (of course they still will be used to define precedence order). This will be default behavior (-kh switch) and -kc will set _strictly_ Clipper compatible mode (no parenthesis stripping at all). This is quite simple modification and final code will be even smaller because the stripping code will be activated only in one place for all list of expressions. The special behavior of enumerator and with_object messages sent to (<var>) will be kept. IMHO it will be much cleaner and simpler then in current code where the stripping is enabled in different chosen places and even some of them are not disable by -kc. If you agree for above modification then I'll commit it ASAP. best regards, Przemek _______________________________________________ Harbour mailing list [email protected] http://lists.harbour-project.org/mailman/listinfo/harbour
