$NOPREFIX: Difference between revisions
Jump to navigation
Jump to search
Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link
No edit summary |
No edit summary |
||
(9 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
The [[$NOPREFIX]] metacommand | The now {{Text|deprecated|red}} [[$NOPREFIX]] metacommand did allow all QB64 functions and statements to be used without the leading underscore. | ||
Line 9: | Line 9: | ||
* QB64-specific keywords are by default prefixed with an underscore, in order to differentiate them from legacy keywords inherited from QBasic/QuickBASIC 4.5. | * QB64-specific keywords are by default prefixed with an underscore, in order to differentiate them from legacy keywords inherited from QBasic/QuickBASIC 4.5. | ||
* The convention exists in order to allow older code to be loaded and compiled in QB64 without naming conflicts with existing variables or constants. | * The convention exists in order to allow older code to be loaded and compiled in QB64 without naming conflicts with existing variables or constants. | ||
* If you are writing new code with QB64, and not importing code from QBasic/QuickBASIC 4.5, [[$NOPREFIX]] allows you to reduce typing by not having to use underscores in modern keywords. | * If you are writing new code with QB64, and '''not importing code''' from QBasic/QuickBASIC 4.5 nor any 3rd party .bi/.bm style libraries, then [[$NOPREFIX]] allows you to reduce typing by not having to use underscores in modern keywords. | ||
* '''SUB _GL''' | ;{{Text|!!! WARNING !!!|red}} | ||
:* Do not use '''$NOPREFIX''' when working with old QBasic/QuickBASIC 4.5 code or when your program depends on 3rd party library code, otherwise you risk a lot of {{Text|"Name already in use"|red}} syntax errors, as the old code or libraries may use variable, SUB or FUNCTION names which conflict with new QB64 keywords if they are not prefixed with an underscore. | |||
:* Once again, use '''$NOPREFIX''' only with new written QB64 code which is fully under your control without any 3rd party dependencies! | |||
* '''SUB _GL''' is an internal routine and must '''always''' be prefixed. | |||
* When [[$NOPREFIX]] is used, QB64 keywords can be used both with or without the leading underscore, so that both [[_DISPLAY]] and [[_DISPLAY|DISPLAY]] are valid in the same program, for example. | * When [[$NOPREFIX]] is used, QB64 keywords can be used both with or without the leading underscore, so that both [[_DISPLAY]] and [[_DISPLAY|DISPLAY]] are valid in the same program, for example. | ||
* [[$NOPREFIX]] must be the first non-comment and non-whitespace line in a program. | * [[$NOPREFIX]] must be the first non-comment and non-whitespace line in a program. | ||
Line 17: | Line 20: | ||
{{PageAvailability}} | {{PageAvailability}} | ||
<!-- QB64 = a version or none, QBPE = a version or all, Platforms = yes or no --> | |||
* '''QB64-PE | <gallery widths="48px" heights="48px" mode="nolines"> | ||
File:Qb64.png|'''v1.4''' | |||
File:Qbpe.png|'''all''' | |||
File:Apix.png | |||
File:Win.png|'''yes''' | |||
File:Lnx.png|'''yes''' | |||
File:Osx.png|'''yes''' | |||
</gallery> | |||
<!-- additional availability notes go below here --> | |||
* '''$NOPREFIX''' was {{Text|deprecated|red}} in '''QB64-PE v4.0.0'''. However, as some concerns arised over the deprecation in our Forum, we decided to implement a converter which offers the automatic conversion of '''$NOPREFIX''' dependent code when trying to compile it. | |||
Latest revision as of 17:18, 18 November 2024
The now deprecated $NOPREFIX metacommand did allow all QB64 functions and statements to be used without the leading underscore.
Syntax
Description
- QB64-specific keywords are by default prefixed with an underscore, in order to differentiate them from legacy keywords inherited from QBasic/QuickBASIC 4.5.
- The convention exists in order to allow older code to be loaded and compiled in QB64 without naming conflicts with existing variables or constants.
- If you are writing new code with QB64, and not importing code from QBasic/QuickBASIC 4.5 nor any 3rd party .bi/.bm style libraries, then $NOPREFIX allows you to reduce typing by not having to use underscores in modern keywords.
- !!! WARNING !!!
-
- Do not use $NOPREFIX when working with old QBasic/QuickBASIC 4.5 code or when your program depends on 3rd party library code, otherwise you risk a lot of "Name already in use" syntax errors, as the old code or libraries may use variable, SUB or FUNCTION names which conflict with new QB64 keywords if they are not prefixed with an underscore.
- Once again, use $NOPREFIX only with new written QB64 code which is fully under your control without any 3rd party dependencies!
- SUB _GL is an internal routine and must always be prefixed.
- When $NOPREFIX is used, QB64 keywords can be used both with or without the leading underscore, so that both _DISPLAY and DISPLAY are valid in the same program, for example.
- $NOPREFIX must be the first non-comment and non-whitespace line in a program.
- Since QB64 v2.0 (incl. all QB64-PE versions) $NOPREFIX can be placed anywhere in a program.
Availability
- $NOPREFIX was deprecated in QB64-PE v4.0.0. However, as some concerns arised over the deprecation in our Forum, we decided to implement a converter which offers the automatic conversion of $NOPREFIX dependent code when trying to compile it.
See also