Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.

Remove casting-away-const-ness#2

Closed
rectang wants to merge 2 commits intoapache:cfish-string-prep1from
rectang:cfish-string-prep1
Closed

Remove casting-away-const-ness#2
rectang wants to merge 2 commits intoapache:cfish-string-prep1from
rectang:cfish-string-prep1

Conversation

@rectang
Copy link
Contributor

@rectang rectang commented Sep 30, 2013

Now that we've migrated from const CharBuf* through const String* to
simply String*, this long-awaited change can be made.

Method typedefs, like method invocation inline functions, are defined
for each class in the inheritance chain.  Prior to this fix, the "self"
type in the typedef was the type of the last concrete implementor
rather than the type of the invocant.
Method invocation functions have been casting away const-ness by
accepting `const prefix_Foo *self` as the invocant but then invoking
the retrieved function pointer with `self` cast to `(prefix_Foo*)`.
This was necessary to avoid warnings from "const CharBuf" immutable
strings -- but now our String type is immutable without requiring
`const`, allowing us to improve type safety by removing the cast.
@asfgit asfgit closed this Feb 20, 2014
@rectang rectang deleted the cfish-string-prep1 branch April 27, 2014 17:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants