-
-
Notifications
You must be signed in to change notification settings - Fork 305
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
Doubts about some *const
pointers
#4301
Comments
The idea of b5640bb was to ensure that the |
FTR the fields are const, not the pointers; don't cast the const away, use the setter |
I'm not sure what you mean by this. Maybe you meant the the pointees aren't const, which I agree.
Except that I count 10 casts outside of the setter. I'm not sure if something that requires adding 10 casts (+ the ones in the setter) is an improvement. Casts are the thing that hides most bugs by far, since they disable almost all compiler warnings. |
as far as i can tell, there's const-casts on both in the setter, merger, and deserialiser, all three of which are Envelope's member functions (or, as close as they can be), and entirely within the scope of the functions that should bypass the const. there's an outlier in not sure where you're getting "cast away all the time" here, this reads to me as being perfectly as-designed (only Envelope members (and friends) are allowed to edit these directly) and as-desired (the shit works so everyone else is forced to use the setters so IMAP works) |
Hmmm, okay.
Just a way of speaking. It's not all the time, but a non-trivial amount: 7/52 $ grep -rn 'real_subj\>' | pee 'wc -l > /dev/tty' 'cat' | grep '(char' | wc -l
52
7
Yup; just that the design implies some slightly dangerous stuff, IMHO. But I guess since it's your design, it's your prerogative.
I would have probably just not forced anything, and just document that the setters should be used. But I know that you prefer C++, so I guess, it's all right. At least now I understand why it's And FTR, I would just remove IMAP from neomutt(1), but that' not going to happen. It would certainly simplify it a lot. :) Thanks for explaining! |
neomutt/email/envelope.h
Lines 70 to 71 in 20fe7bd
What's the use of these
*const
s if you have to cast them away all the time?@nabijaczleweli
The text was updated successfully, but these errors were encountered: