https://bugs.documentfoundation.org/show_bug.cgi?id=152132
Bug ID: 152132
Summary: Hash Mark Lines (#define) treated as comments in Libre
Office Basic
Product: LibreOffice
Version: 7.4.2.3 release
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: enhancement
Priority: medium
Component: BASIC
Assignee: [email protected]
Reporter: [email protected]
Description:
#if fred
Is treated as a comment.
It should always be treated as an error.
Steps to Reproduce:
Create new Basic subroutine:
sub Mysub
#if fred
dim a as int
#else
dim a as int
#endif
end sub
Run the sub.
1.Import VBA module containing #if, #else, #endif
2.Run any function in the module
3.
Actual Results:
BASIC syntax error. Variable a already defined.
Expected Results:
Lines starting with # are errors
Reproducible: Always
User Profile Reset: Yes
Additional Info:
It would be really nice if BASIC handled #if, #else the same way VBA 6 or 7 do:
as conditional compilation meta commands. Some older OO versions handled this
differently, the initial syntax check handled #if as if: for declaration
outside of a function I got "If outside of function or sub is not allowed"
But the present implementation is even worse: #if and #else are silently
ignored when inside a function, so both branches are included.
In VBA back to Office 97, #if allows you to include different branches for
different #defines. There are predefined values ('Win32' etc), and two
different ways of defining values. #if is commonly used to allow different
branches for VBA7 and OSX: it may also be used generally, as for debug builds.
When VBA code is imported into LO, the idiosyncratic treatment of # meta
commands is confusing and unexpected: the lack of documentation contributes to
the problem.
Implementing the feature correctly would be good: implementing the feature in a
minimal way with a clear error message would be good enough.
Version: 7.4.2.3 (x86) / LibreOffice Community
Build ID: 382eef1f22670f7f4118c8c2dd222ec7ad009daf
CPU threads: 4; OS: Windows 6.1 Service Pack 1 Build 7601; UI render:
Skia/Raster; VCL: win
Locale: en-AU (en_AU); UI: en-US
Calc: threaded
--
You are receiving this mail because:
You are the assignee for the bug.