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

Fix arithmetic operation on void pointer #803

Merged
merged 1 commit into from
Apr 13, 2018

Conversation

proski
Copy link
Contributor

@proski proski commented Mar 19, 2018

No description provided.

Copy link

@ThomasAdam ThomasAdam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. There's no need to cast this.

@proski
Copy link
Contributor Author

proski commented Mar 19, 2018

One reason is that I want to be consistent with the existing code. Just look for other occurrences of malloc, calloc and realloc - many of them have casts. Another reason is that I want the code to be C++ compatible. I know many C projects that support compilation with a C++ compiler - it catches many more warnings than any C compiler. tig is not C++ compilable, but it can be done.

@ThomasAdam
Copy link

ThomasAdam commented Mar 19, 2018

Well, the existing code should also be changed -- and I'd argue that's what you should do instead of this pull request, rather than perpetuating bad practises through casting these return types.

As far as compatibility with C++ compilers go -- that's a red-herring. I really struggle with projects which try to do this -- and AFAICT, I don't consider tig to be in that camp.

@proski proski force-pushed the fix-pointer-arith branch from 8beeed5 to 7614328 Compare April 4, 2018 16:20
@proski
Copy link
Contributor Author

proski commented Apr 4, 2018

The cast has been removed, it's not essential for fixing the -Wpointer-arith warning.

@jonas
Copy link
Owner

jonas commented Apr 13, 2018

Thanks @proski ! 👍

@jonas jonas merged commit 0ea017d into jonas:master Apr 13, 2018
rolandwalker pushed a commit to rolandwalker/tig that referenced this pull request May 21, 2018
@proski proski deleted the fix-pointer-arith branch December 30, 2022 06:06
@proski proski restored the fix-pointer-arith branch December 30, 2022 06:07
@proski proski deleted the fix-pointer-arith branch February 25, 2023 05:43
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

Successfully merging this pull request may close these issues.

3 participants