On Sat, Nov 24, 2018 at 5:19 PM Rob Stewart via Boost
Your point that a cast may not be the best solution to eliminating warnings is valid. Assertions, range checking, or library solutions are necessary to know that operations are safe. With those in place, pragmas and casts can be used to silence warnings.
I wouldn't place pragmas and casts in the same category. Using a pragma to silence a warning will not alter the program semantically, while a cast will.
You may argue that the implicit conversion is correct, but it is as much subject to breakage by future maintenance as your example.
I could argue that the implicit conversion is more likely to be correct, but I didn't do that. Here is my argument again: 1) A cast has different semantics than an implicit conversion. 2) If the implicit conversion is correct, replacing it with a cast to silence a warning is incorrect. Which of these two points do you think is false?