Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 3 of 3 total |
+1 = 0 |
Tue, Sep 29 2015 7:31 AM | Permanent Link |
Michael Dreher | Hi,
I get unexpected results using "+" or "-" as unary prefix operatoras in numeric literals. Example: procedure TForm1.Button1Click(Sender: TObject); begin Label1.Caption := 'test123'; // this is only to find the function in the JavaScript output Label1.Caption := IntToStr(1); // prints 1 to label Label1.Caption := IntToStr(-1); // prints -1 to label Label1.Caption := IntToStr(+1); // prints 0 to label (since the subject of this thread) Label1.Caption := IntToStr(-(-1)); // prints 0 to label Label1.Caption := IntToStr(+(-1)); // prints 0 to label end; Since I get no compiler error, the + and - signs should be valid. In the help (Operators) both "+" , "-" operators are only listed as binary infix. The JavaScript output: unit1_tform1.$p.tform1_button1click = function(sender) { var $t = this; $t.tform1_label1.tlabelcontrol_setcaption("test123"); $t.tform1_label1.tlabelcontrol_setcaption(inttostr(1)); $t.tform1_label1.tlabelcontrol_setcaption(inttostr(-1)); $t.tform1_label1.tlabelcontrol_setcaption(inttostr(0)); $t.tform1_label1.tlabelcontrol_setcaption(inttostr(0)); $t.tform1_label1.tlabelcontrol_setcaption(inttostr(0)); $t.tform1_label1.tlabelcontrol_setcaption(inttostr(0)); }; Michael Dreher |
Tue, Sep 29 2015 7:44 AM | Permanent Link |
Matthew Jones | Michael Dreher wrote:
> Since I get no compiler error, the + and - signs should be valid. Not able to answer your question, but EWB2 fixes a few things around + from what I've seen. I had a line of code that works in EWB 1 of: lblCount.Caption := + IntToStr(m_xCart.ProductCount) + ' items'; That failed to compile (correctly) in EWB 2. (There is a + at the start of the rvalue). It will be interesting to see what Tim says on this numeric instance. -- Matthew Jones |
Tue, Sep 29 2015 11:52 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Michael,
<< I get unexpected results using "+" or "-" as unary prefix operatoras in numeric literals. >> It's a compiler emit bug. A fix will be in 2.02. Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Wednesday, March 27, 2024 at 05:29 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |