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

[BUG] token stores start, count instead of string_view to save space, but padding gets in the way #517

Closed
PoetaKodu opened this issue Jun 17, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@PoetaKodu
Copy link

Describe the bug

I came across this comment:
https://github.com/hsutter/cppfront/blob/main/source/lex.h#L312

The problem is that because of padding, the structure takes up the same amount of space as if it
contained string_view instead.

Another problem is that in theory user could input a string literal token that is over 2^16 characters long.

@PoetaKodu PoetaKodu added the bug Something isn't working label Jun 17, 2023
@PoetaKodu PoetaKodu changed the title [BUG] token stores ptr, count instead of string_view to save size, but padding gets in the way [BUG] token stores start, count instead of string_view to save size, but padding gets in the way Jun 17, 2023
@PoetaKodu PoetaKodu changed the title [BUG] token stores start, count instead of string_view to save size, but padding gets in the way [BUG] token stores start, count instead of string_view to save space, but padding gets in the way Jun 17, 2023
@JohelEGP
Copy link
Contributor

Another problem is that in theory user could input a string literal token that is over 2^16 characters long.

The current implementation uses int16_t,
which means the max is $2^{15}-1$,
as opposed to the minimum of $2^{16}$
required at https://eel.is/c++draft/implimits#2.16.sentence-1.

zaucy pushed a commit to zaucy/cppfront that referenced this issue Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants