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

GlyphFactory.cpp:20:22: error: array subscript has type 'char' [-Werror=char-subscripts] #2

Open
franz-ms-muc opened this issue Nov 19, 2021 · 4 comments

Comments

@franz-ms-muc
Copy link

GlyphFactory.cpp:20:22: error: array subscript has type 'char' [-Werror=char-subscripts]

char is signed on some machines. 

a Subscript of an Array is defined unsigned in C (0....n)

@franz-ms-muc
Copy link
Author

https://github.com/Meisterschulen-am-Ostbahnhof-Munchen/Design-Patterns-GoF-on-ESP32/blob/feature/1/Structural_Patterns/Flyweight/components/Flyweight_component/GlyphFactory.cpp

here i will correct it so it runs in ESP32. please Double check it before take over to your Repo, because i do not check if it is running on PC !

@franz-ms-muc
Copy link
Author

same Story for the delete[]. there is no new[]. so delete[] is wrong. 

https://stackoverflow.com/questions/2425728/delete-vs-delete-operators-in-c

@BartVandewoestyne
Copy link
Owner

same Story for the delete[]. there is no new[]. so delete[] is wrong. 

https://stackoverflow.com/questions/2425728/delete-vs-delete-operators-in-c

Thanks. I fixed the GlyphFactory destructor in commit d2641d8.

@BartVandewoestyne
Copy link
Owner

GlyphFactory.cpp:20:22: error: array subscript has type 'char' [-Werror=char-subscripts]

char is signed on some machines. 

a Subscript of an Array is defined unsigned in C (0....n)

I agree that there is an issue with the code and that this warning is justifiable. However, this is how the code in the book is.
I am thinking of keeping the book's code in the master branch and then creating an extra branch for all the bugfixes to the book's code. Doing a diff between the master branch and that branch would then show where the book's code had some issues...

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