Bug? Neither IDE nor compiler detects the invalid string declaration: Private strMsg as string=""Hello world"

toby

Well-Known Member
Licensed User
Longtime User
Code: Copy
Private strMsg as string=""Hello world"  'I meant to type "Hello world"
log(strMsg) 'Empty string is printed

As shown, there is an extra double quote, by mistake, at the beginning of the text. And both IDE and compiler ignore Hello World" part once they reach the second double quote thinking it's an empty string.
 
Last edited:
not ignored; doesn't compile here...
 

Attachments

  • capture.jpg
    capture.jpg
    35.7 KB · Views: 312
Last edited:
I've finally figured out how to reproduce

Step 1. Declare a valid string.
Code: Copy
Private strMsg as string="Hello world"

Step 2. Insert a double quote anywhere in the above string:
Code: Copy
Private strMsg as string="Hell"o world"
IDE will happily accept it without further validation while compiler would truncate the string at the insertion point. The above declaration will cause strMsg to contain "Hell" instead of expected "Hello World".
 
Last edited:
Back
Top