Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A *zstringptr can be assigned to a numeric var #111

Open
countingpine opened this issue Nov 2, 2018 · 1 comment
Open

A *zstringptr can be assigned to a numeric var #111

countingpine opened this issue Nov 2, 2018 · 1 comment

Comments

@countingpine
Copy link
Collaborator

As observed in https://freebasic.net/forum/viewtopic.php?p=254055#p254055

dim as zstring ptr  zptr = @"Hi"
dim as string  s = *zptr         '' "Hi"
dim as integer i = *zptr         '' asc("H")
print i, s, z10                  '' 72, Hi, Hi

I thought we'd fixed something like this before, but I can't find an existing bug report or changelog entry.

Potentially similar bugs were fixed at:

@dkl
Copy link
Member

dkl commented Nov 2, 2018

It could be because of string indexing; there were quite some special cases in fbc treating z/wstring pointer deref's specially because of that, treating such expressions as wchar/char integers in some places but strings in others. So for example, zstringptr[0] is treated the same as (*zstringptr)[0] in some contexts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants