n/m
Re: constant when used by reference.
I would expect that, it works as a string so why not by address, the string is constant and so is it's address
Re: constant when used by reference.
The explanation is in the help here
https://www.purebasic.com/documentation ... rules.html
But indeed, everyone was mistaken one day or another with the use of @.
M.
https://www.purebasic.com/documentation ... rules.html
In addition, help does not clearly indicate that the operator '@' only works with variables and procedures.Constants
All constants are preceded by the hash # character. They can only be declared once in the source and always keep their predefined values. (The compiler replaces all constant names with their corresponding values when compiling the executable.)
But indeed, everyone was mistaken one day or another with the use of @.
M.
Re: constant when used by reference.
[withdrawn]
Last edited by jassing on Sat Jun 03, 2023 9:02 pm, edited 1 time in total.
Re: constant when used by reference.
As Mesa wrote:jassing wrote: ↑Sat Jun 03, 2023 3:16 pmhow does that explain it?Mesa wrote: ↑Sat Jun 03, 2023 10:26 am The explanation is in the help here
https://www.purebasic.com/documentation ... rules.html
The compiler replaces all constant names with their corresponding values when compiling the executable.
It may work for a string, because a string has an address, but what about
Code: Select all
#MyConst = 123
Debug @#MyConst
Code: Select all
Debug @123
PureBasic 6.04/XProfan X4a/Embarcadero RAD Studio 11/Perl 5.2/Python 3.10
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Re: n/m
issue has "already been discussed" and is expected behaviour - so there's no point in continuing ... I wasted people's time & forum space. I assumed constant replacement was similar to macro expansion - the token is replaced by the value. but I made an ass out of myself by assuming incorrectly.
- NicTheQuick
- Addict
- Posts: 1224
- Joined: Sun Jun 22, 2003 7:43 pm
- Location: Germany, Saarbrücken
- Contact:
Re: n/m
If anybody would do this this forum would be just unnecessary. Please don't do that.jassing wrote: ↑Sun Jun 04, 2023 4:01 pmissue has "already been discussed" and is expected behaviour - so there's no point in continuing ... I wasted people's time & forum space. I assumed constant replacement was similar to macro expansion - the token is replaced by the value. but I made an ass out of myself by assuming incorrectly.
Seemingly dumb questions are important questions too.
Now this thread has lost its sense and it can safely deleted.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
Re: n/m
Would also be something for a features request to get the addresses on string constants.
As already written, this has been mentioned before.
As already written, this has been mentioned before.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: n/m
@jassing, it's not good behavior to delete your post contents, it leaves unusable topics. It's not an issue if you asked something wrong, nobody will come at you